Sounds Logical
home

WaveWarp 2.0 Example DrawingBoard

Index Current Example DrawingBoard Group Previous Example DrawingBoard Group Next Example DrawingBoard Group Previous Example DrawingBoard Next Example DrawingBoard Bottom of Page

Description | Components Used

SpectralPeakDetectionEducationalExample

Description
Spectral Peak Detection Educational Example Illustrates the use of the Spectral Peak Detector for determining the frequency and amplitude of the dominant spectral component in an audio signal. The frequency of the spectral peak (in Hz) is the first output Control Signal, and the root-mean-square amplitude is the second output Control Signal. For convenience, their values are displayed in the Simple Control Displays. Run the DrawingBoard and observe that the peak frequency detected (with the default DrawingBoard settings) is 5900 Hz with an rms amplitude of 0.558. This pertains to the signal from the first input Sine Wave Generator whose frequency is set to 5908 Hz with an amplitude of 0.999 (rms of 0.706). Now reduce the amplitude of the the first Sine Wave Generator signal until it falls below 0.5. The output of the peak detector will change to 3294.58 Hz with an rms amplitude of 0.269. This pertains to the the signal from the second input Sine Wave Generator whose frequency is set to 3303 Hz and amplitude of 0.499 (rms of 0.352), and thus becomes the dominant component when the amplitude of the first is brought below 0.5. The output of the detector is not exact because it is based on the Discrete Fourier Transform (implemented via the FFT). This means that the frequency resolution (in Hz) is limited to the sample rate divided by the FFT buffer length. In this example, the sample rate is 44100 Hz and the (default setting for the) FFT buffer length is 2048, yielding a frequency resolution of approximately 21.5 Hz. To verify this, try gradually increasing the frequency of a Sine Wave Generator while watching the output frequency from the peak detector. You will note that the peak detector will not be able to continually track the smooth changes in the input frequency, but rather will jump in increments of 21.5 Hz. You can increase the frequency resolution by increasing the FFT buffer length, though at the expense of reduced time resolution. This frequency-versus-time resolution is the classic trade-off surrounding the use of the FFT. One method for approximating the true frequency of a spectral component within an FFT bin is to "track" the phase of that component across successive FFT frames, and to derive the "true" frequency by dividing the phase difference with the time interval between successive frame snapshots. This technique is implemented in the "Tracking Peak Detector" block and its use is illustrated in the "TrackingSpectralPeakDetectionEducationalExample" DrawingBoard. Another limitation of the FFT representation is that the input signal is treated as a purely periodic signal which is exactly repeated at intervals determined by the FFT buffer length. This means that only those input signals which happen to be exactly periodic with respect to the FFT buffer length will be accurately represented by the FFT. Any signal which is not exactly periodic with respect to the FFT buffer length will be "smeared" by the FFT into multiple frequency bins, yielding an erroneous representation of the true spectral characteristics. Another way of interpreting this phenomenon is to consider that a signal which is not exactly periodic with respect to the FFT buffer length will have "discontinuities" at the boundaries between successive FFT buffer frames. Under the FFT transformation, these discontinuities introduce spurious spectral contributions which are not present in the actual signal. Using this DrawingBoard, you can appreciate the effect of these anomalies by slowly changing the frequency of the input signal whilst keeping its amplitude constant, and whilst keeping the FFT buffer length constant. As the period of the signal changes with respect to the period determined by the FFT buffer length, the peak detector amplitude output will not show a constant value, even though the signal amplitude is unchanged. The classic technique for reducing these anomalies is to "window" the input signal before performing the FFT. This amounts to pre-multiplying the input data by a smooth function which falls to zero at the edges of the frame boundaries, thus smoothing out the discontinuities and eliminating much of the spurious spectral content. You can investigate the effect of windowing with this Drawing Board by selecting, say, the "Hanning" window type (instead of the default "None") and repeating the previous exercise, i.e. varying the frequency of the input signal without changing its amplitude or FFT buffer length. You will note that the amplitude output of the peak detector is now almost constant irrespective of the frequency, thus demonstrating that the windowing has successfully eliminated most of the spurious spectral content associated with the un-windowed case. However, you will also note that the numerical value of the detected rms amplitude is not exactly what it should be. This is an unavoidable consequence of windowing whereby the effect of pre-multiplying the data by a smoothing function is to modify the input signal from its original form. Generally, the amplitude of the signal is reduced (particularly in the tails of the window) which explains why the amplitude output from the peak detector is generally numerically smaller (but constant !) when compared with the un-windowed case.
Components used:

Index Current Example DrawingBoard Group Previous Example DrawingBoard Group Next Example DrawingBoard Group Previous Example DrawingBoard Next Example DrawingBoard Top of Page

home - news - products - store - support - site map - company info
© 2007 Sounds Logical. All rights reserved.
Sounds Logical
legal notice - privacy statement