MUSC 108. Introduction to Music Technology - Fall 2013

12 Lab 4 - Sound Out

[Syllabus] [Overview]

In 12Lab4 you'll hear waveforms you created in Lab3.

Change Frequencies

The Excel Spreadsheet lab12_3sineWave.xlsx should still be open.

Change F_1 to 250 Hz and F_2 to 600 Hz.

change frequencies

The graphs should update.

Updated graphs

Note: You can choose the amount of data to display in each graph. Right click (or Control click) in the Sine1*Sine2 graph and choose Select Data. In the Select Data Display dialog change the $H$22050 item to $H$500.

Graph Zoom

Graph 4 now shows the first 499 data points.

Zoomed display

Save The Excel Samples for Sine1

Open a new blank document in TextWrangler.

Copy Excel samples E2:E22051 and paste them into TextWrangler.

Save the TextWrangler file to the Desktop as sine1.txt.

xl2wav

I wrote a small command line tool called xl2wav that converts the Excel samples into a binary data file that can be opened and played in Audacity.

Open Terminal and enter these commands. Tilde ~ represents your home folder.

$cd ~/Desktop
$ xl2wav sine1.txt

Terminal should repspond with Data written to sine1.raw.

Data written

Open Audacity

Choose Import/Raw Data... from the File menu.

Audacity Import menu

Import the "Desktop/sine1.txt.raw" file.

The Import Raw Data dialog will appear. The default settings should be correct.

Audacity Import settings

You should see this.

Audacity Sine1

Play

Repeat the Process for Columns F, G, and H

Save them all to the Desktop with unique TextWrangler file names.

After importing all files into Audacity you should see this.

All four wave files

Using the Solo button, play each waveform.

Number three doesn't sound good, it's distorted.

Let's Zoom in on the waveforms. Notice that waveform three has been clipped. The tops and bottoms of the waveform are flat. That causes the distortion. The reason is that Sine1 and Sine2 both had amplitudes of 1.0. When they were added together, amplitudes that were greater than 1.0 were clipped.

All four in Audacity zoomed

Delete waveform 3 in Audacity by clicking the X in the upper left corner of the track info panel.

Back in Excel, look at the graph of Sine1+Sine2. It's clipping, the sample values exceed ±1.

Excel clipping

The Excel formula for Sine1+Sine2 was: =A*(E2+F2)

A is a defined name representing the overall amplitude. Change B4 to 0.45 and the clipping is gone.

Excel no clipping

Import the new column G data into Audacity. Listen to the Sine1+Sine2 track again. The clipping should be gone.

Plot Spectrums

Sine 1 displays one peak at 250 Hz.

fft sine1

Sine 2 displays one peak at 600 Hz.

fft sine2

Additive Synthesis

Sine1 + Sine2 displays two peaks at 250 Hz and 600 Hz.

fft sine1+sine2

Ring Modulation

Ring Modulation multiplies two waveforms together. The output is the sum and difference of the two frequencies. This corresponds to the trigonometric identity for multiplying two sine or cosine waves. The fundamental frequencies (A and B) of each waveform will be missing.

Cos AB formula

Sine1 * Sine2 displays two peaks at 350 Hz (600-250) and 850 Hz (600+250).

fft sine1*sine2

MUSC 208 winter term will go into digital audio, signal processing, and synthesis in more detail.

[Syllabus] [Overview]

Revised John Ellinger, January - September 2013