Previous Up Next

5.24.10  Visualizing power spectra : plotspectrum

plotspectrum takes an audio clip as its first argument and optionally a range in form range=[lf,uf] or range=lf..uf, where lf is the lower bound and uf the upper bound of the desired frequency band, as its second argument. The command displays the power spectrum of the audio data on the specified frequency range (by default [0,s/2], where s is the sampling rate). If the audio clip has more than one channel, the channels are mixed down to a single channel before computing the spectrum.

For example, assume that a male voice is recorded in the file example1.wav. Input :

clip:=readwav("/path/to/sounds/example1.wav"):;
plotspectrum(clip,range=[0,1500])

Output :

One can observe that the dominant frequency is around 220 Hz, which is the middle of tenor range. This is consistent with the fact that a man is speaking in the clip.


Previous Up Next