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

SpectralThreePeakDetectionEducationalExample

Description
Spectral Three Peak Detection Educational Example Illustrates the use of the Spectral 3-Peak Detector for determining the frequencies and amplitudes of the 3 dominant spectral components in an audio signal. See the "SpectralPeakDetectionEducationalExample" for a detailed discussion on the use of the FFT for spectral peak determination. The extension to 3 peaks (instead of just the dominant peak) is straightforward. Run the DrawingBoard and observe (in the first, third, and fifth Simple Control Displays, respectively) that the peak frequencies detected (with the default DrawingBoard settings) are 710.59 Hz, 86.13 Hz, and 3057.71 Hz. These represent the closest FFT bins to the true frequencies (as set in the Sine Wave Generators) of 715 Hz, 80 Hz, and 3066 Hz, respectively. The discrepancy between the measured frequencies and their true values is due to the finite frequency resolution of the FFT, which, for the sample rate of 44100 Hz and the FFT buffer length of 2048 chosen here, amounts to about 21.5 Hz. This finite resolution can be further verified by gradually changing the frequency(ies) of the input signal(s) and observing the output frequencies 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(ies), 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 3-Peak Detector" block and its use is illustrated in the "TrackingSpectralThreePeakDetectionEducationalExample" 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