MUSC 108. Introduction to Music Technology - Fall 2013

11 Lab 1 - Introduction to Audacity

Setup

In unit 11-13 labs and your second take home quiz you'll be working with the open source audio editor Audacity. You can download and install it on your computer from http://audacity.sourceforge.net/. The current version is 2.0.4.

Icon Audacity

Open Audacity and Generate a 100 ms Sine Wave at 500 Hz

Open /Applications/ Audacity and choose Tone from the Generate menu.

generate tone

Choose hh:mm:ss +milliseconds from the Duration popup menu.

hours minutes seconds milliseconds

Set the Frequency to 500 and click OK

SineA440

One hundred milliseconds of a 500 Hz sine wave will be shown in the Audacity window.

Click the Play button.

Select short segment

Audacity Window Overview

A very good description of the Audacity interface is found at: http://manual.audacityteam.org/o/

An open source user manual for Audacity is found at: http://en.flossmanuals.net/audacity/

In Lab 7 these are the tools we'll use.

Track Control Panel

Track Control Panel

Track Options Menu

You'll rarely need to change these.

Track Options menu

The standard setting for Set Sample Format is 32 bit float. The standard setting for Set Rate is 44100 Hz.

Transport toolbar

Play toolhttp://manual.audacityteam.org/o/man/transport_toolbar.html

Tools Toolbar

Selection tool

Icon Name Description
tool select Select

The main tool used to select audio.

tool zoom Zoom Select a portion of the waveform to zoom in on.
tool time shift Time Shift Move audio an region to a new time position.

Zoom Tools

Icon Name Description
tool zoom in Zoom In Zoom in on the selected refion of the waveform eventually reaching the individual sample level.
tool zoom out Zoom Out Zoom out.
tool fit selection Fit Selection Fit the selected region to the width of the window.
tool fit project Fit Project Fit the entire project to the width of the window.

Experiment with these tools now.

When you're done, click the Fit Project tool.

Calculate the Frequency in the Time Domain

Frequency and Period

Frequency and period are inversely related.

F=1/P and P=1/F

Select a little more than one period of the sine wave and click the Fit Selection tool.

Select one period before zoom

Refine the selection to include exactly one period. Set the Length popup menu to display samples.

Samples in one period

Sample Rate (SR) and Sample Period (T)

If you know the Sampling Rate and the number of samples in one period of the waveform you can calculate its frequency.

We'll be using the CD audio sampling rate or sampling frequency of 44100 Hz. The sampling period is the reciprocal of the sampling rate. By convention we'll use SR for sampling rate and T for sampling period.

SR=44100 and T=1/SR

Calculate the Frequency By Counting the Number of Samples in One Period

One period of our sine wave is 88 samples long. You can calculate the frequency like this.

SR 44100 samples/second sampling frequency
T 1/44100 seconds/sample duration of one sample
P 88 * T figure it out
F 1/P figure it out

Alternatively you can calculate the frequency like this.

SR 44100 samples/second  
P 88 samples/period  
F SR/P (periods/second) figure it out

We know the frequency should be 500 Hz but that's not what the calculation showed. We'll need to refine our calculation.

Refine the Frequency Calculation

Use the Zoom tool Zoom tool to select a very small region just before and after the start of the second period.

Zoom tool selection

Further refine the selection by selecting four samples starting with sample 87.

Zoom in refine selection

If you calculate the frequency for periods of 88 and 89 samples you get:

Period in Samples Calculated Frequency
88 501.14
89 495.50

The true frequency lies somewhere between a period length of 88 and 89 samples. Because the Sine wave phase was zero, the first period started with sample value zero. We're looking for the zero crossing point between sample 88 and 89.

sample 88 zoom in

Guessing that the zero crossing is about 1/4 of the way between 88 and 89 lets say the period is 88.25 samples. That's pretty close to 500 Hz.

Period in Samples Calculated Frequency
88.25 499.72

Calculate the Frequency Using the Fast Fourier Transform (FFT)

The most common way to display frequency components of an arbitrary waveform is to use the Fast Fourier Transform. The FFT is a mathematical transform that converts a sampled sound from the time domain into the frequency domain. A graph of the FFT output displays the individual frequencies found in the sound. In Audacity the FFT is invoked using the Plot Spectrum menu command in the Analyze menu.

Click here in the Track Control Panel to select the entire waveform.

Track select all

Use the Fit Project tool Fit project tool to display the entire waveform.

Select all

Choose Plot Spectrum from the Analyze menu.

Plot Spectrum menu

When the Frequency Analysis window appears make these settings for Algorithm, Function, Size, and Axis. Position the cursor in the center of the frequency spike and read the Peak value of 500 Hz.

FFT Spectrum

Continue with 11Lab2.

[Overview] [Syllabus]

Revised John Ellinger, January - September 2013