Spectral analysis in Octave

spectrum.m is a program for computing the Fourier spectrum of a 512-sample portion of a signal X at samples 15000 to 15511. To obtain the spectrum in a different position in the file, you'll need to change these numbers in the script, or add a line to get the position from user input.

For the calculation of the FFT, it uses the fft function, which is from the signal processing toolkit.

For example, to get the spectrum at around sample 5104 of glass.raw (the middle of the vowel [a]), type in Octave:

signal_in

Enter the filename glass.raw

Assign X = In;

Type

spectrum

Next: Explanation of spectrum.m