Digital Sound & Music: Concepts, Applications, & Science, Chapter 2, last updated 6/25/2013
Figure 2.41 Frequency analysis view (left) and waveform view (right) in Adobe Audition, showing audio dat
in the frequency domain and time domain, respectively
2.3.9 Applying the Fourier Transform in MATLAB
Generally when you work with digital audio, you don't have to implement your own FFT.
Efficient implementations already exist in many programming language libraries. For example,
MATLAB has FFT and inverse FFT functions, fft and ifft, respectively. We can use these to
experiment and generate graphs of sound data in the frequency domain.
First, let's use sine functions to generate arrays of numbers that simulate single-pitch
sounds. We'll make three one-second long sounds using the standard sampling rate for CD
quality audio, 44,100 samples per second. First, we a generate an array of sr*s numbers across
which we can evaluate sine functions, putting this array in the variable t.
sr = 44100; %sr is sampling rate
s = 1; %s is number of seconds
t = linspace(0, s, sr*s);
Now we use the array t as input to sine functions at three different frequencies and phases,
creating the note A at three different octaves (110 Hz, 220 Hz, and 440 Hz).
x = cos(2*pi*110*t);
y = cos(2*pi*220*t + pi/3);
z = cos(2*pi*440*t + pi/6);