The harder you work, 
Spectral Analysis with gnu Octave 
After reading the file into memory, the application steps piecewise through the audio file in units of time determined by the constant ‘tdelta’. Specifically, the number of samples in a sampleSet, denoted ‘nn’, is equal to the sample rate at which the file was recorded multiplied by the constant ‘tdelta’. To each sampleSet’s channel, a Hamming filter is applied in the time domain by multiplication (not convolution), which has the practical effect of attenuating “end effects” (and the formal effect of yielding finite bounds for the FFT). Next, the complex Fast Fourier Transform is calculated, from which the real Discrete Fourier Transform is extracted. For this application we are only interested in the magnitude of the basis functions (not their phase), so they are calculated during the DFT extraction. (The complex values are converted from rectangular to polar form while discarding phase angles.) Finally, depending on the values of dAudio, dAnalysis, and dAnalyzer, the corresponding display functions may be called. dispAudio() is a very simple function which employs gnuPlot to display the unmodified PCM data for a sampleSet (figure 1). 
3 of 4

www.MichaelDWelch.net MichaelDWelch@(nospam)acm.org www.linkedIn.com/in/MichaelDWelch 3039209749 remove (nospam) 
nn = sampleRate * tdelta; 
hamm = hamming(nn); 
ffdata = fft(data2); 