The frequency bins provided by the host application are interleaved pairs of numbers representing the complex values of the spectrum. The even indexed values are the real components of the spectrum and the odd indexed values are the imaginary components. Negative frequency bins are found in the top of the input data array. The following figure shows the basic schematic for the input frequency spectrum.
MzSpectrogramHost takes this complex spectrum data and calculates the magnitude spectrum in the non-interface function called makeMagnitudeSpectrum(). Note that only the positive magnitude spectrum is being calculated, since the source waveform is expected to be real-valued. The magnitude spectrum of the negative frequencies is a mirror image of the onse for positive frequencies, and therefore does not have any new information about the signal.
The following figure shows three panes from Sonic Visualiser. The top pane displays the waveform of the audio. The second pane displays the magnitude spectrum (zoomed from 0 to 1000 Hz) which was created by MzSpectrogramHost; and the final pane shows the same spectrogram output generated internally in Sonic Visualiser.
Click here to listen to the corresponding sound
The source code for the plugin was last modified on 21 Jun 2006.