|
| WaveWarp 2.0 Example DrawingBoard

TrackingSpectralPeakDetectionEducationalExample
Description
Tracking Spectral Peak Detection Educational Example
Illustrates the use of the Tracking 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 5908.06
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 3303.04 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.
In contrast with the simplistic approach of merely determining the FFT frequency bin containing the largest amplitude
component (as implemented in the "Spectral Peak Detector" block illustrated in the
"SpectralPeakDetectionEducationalExample" DrawingBoard), the "Tracking Peak Detector" demonstrated here
approximates the true frequency of a spectral component within an FFT bin by "tracking" the phase of that component
across successive FFT frames, and deriving the "true" frequency by dividing the phase difference with the time interval
between successive frame snapshots. In this way, the detector can determine the fequency (and track its changes) to
high precision, overcoming the limitations imposed by the straightforward use of a single FFT frame. For example,
the default settings of this DrawingBoard are such that raw frequency resolution of the FFT is about 21.5 Hz (i.e. the sample
rate of 44100 Hz divided by the FFT buffer length of 2048). In the straightforward approach, this would mean that the FFT
could only "locate" the spectral peak to within 21.5 Hz. (To verify this, open the
"SpectralPeakDetectionEducationalExample" DrawingBoard and 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.)
However, with the "phase tracking" technique implemented here, the raw FFT frequency resolution limitation can be
overcome. 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
be able to continually track the smooth changes in the input frequency, rather than jump in increments of 21.5 Hz.
As just demonstrated, the "phase tracking" technique allows us to overcome the frequency resolution limitation of the
FFT. However, 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.
[Ref.: "The Use of the Phase Vocoder in Computer Music Applications", James A. Moorer, Journal of the Audio
Engineering Society, 1978, Volume 26, Number 1/2, p 42--45.]
Components used:

|
|