|
| WaveWarp 2.0 Example DrawingBoard

LiveGuitarTunerWithDownsampling_3
Description
Live Guitar Tuner With Downsampling
Demonstrates the use of WaveWarp's live input functionality combined with the spectrum analysis components to build a
guitar tuner from scratch. Furthermore, this DrawingBoard makes use of WaveWarp's multirate functionality to
greatly increase the computational efficiency of the tuner. Compare this with the "LiveGuitarTuner" Example DrawingBoard
which does not take advantage of WaveWarp's multirate capabilities. Since the guitar fundamental modes are typically
relatively low in frequency (e.g. maximum of approx. 330 Hz for E2 in conventional tuning), considerable computational
efficiency can be realised by downsampling the signal before performing the spectral analysis. In this example, the signal is
downsampled by a factor of 50. This means that all components downstream of the downsampler are executed at 882 Hz
instead of at 44100 Hz (the input soundcard sample rate), leading to considerable computational efficiencies. Compare
the CPU usage of this DrawingBoard with the "LiveGuitarTuner" DrawingBoard and you will observe the drastic
performance improvement achieved using multirate methods.
Note that in this example, a simple downsampler has been used without any protection against aliasing. This is the
fastest form of downsampling but should generally be avoided since it introduces audible artefacts due to aliasing.
However, in the present application, it is acceptable to use this simple approach since the highest frequency of interest
corresponds to approximately 330 Hz (i.e. the open top string of the guitar). This is below the Nyquist rate of the
downsampled system (i.e. 441 Hz). Even though the higher harmonics produced by plucking the top string will be higher
than 441 Hz, their contributions relative to the fundamental will be small, as will their aliased artefacts, and therefore they will
not disturb the spectral measurements used in the tuning process. Furthermore, since there is no requirement to listen to the
downsampled signal in this tuning application, the aliasing can be ignored.
Another important point to note is that the use of downsampling makes the design of the IIR filter (used to select the desired
fundamental frequency and supress the harmonics) much simpler since the filter cut-off frequencies are no longer located at
the extreme low end of the frequency range. For example, the filter used for isolating the fundamental mode of the sixth
string requires a cut-off frequency in the regime of 90 Hz. For the single-rate system with a sample rate of 44100 Hz (as
implemented in "LiveGuitarTuner"), this implies a normalised cut-off frequency of approx. 0.005. It is very difficult to design
a filter with a low transition width at such low (normalised) frequencies. In fact, referring to the "LiveGuitarTuner" Example
DrawingBoard, you will note that the lowpass filter settings for selecting the sixth string has a transition width of 551 Hz! By
contrast, with the current downsampled system, the filter design is not confined to the extreme low end of the normalised
frequency range. This allows much better filter designs with drastically improved frequency selectivity. In fact, a bandpass
filter can be used to carefully select the fundamental mode, whereas the design of a bandpass filter at extremely low
frequencies in "LiveGuitarTuner" Example DrawingBoard was not feasible, and a relatively crude lowpass had to suffice.
Now plug an electric guitar into the "input" of your soundcard, hit "Play", and proceed to tune your guitar as described in
the "LiveGuitarTuner" Example DrawingBoard.
Listed below are the fundamental frequencies corresponding to the conventional guitar tuning using
the "tempered scale" (also shown in parentheses are the suitable settings for the bandpass filter in
terms of its normalised frequencies for a sample rate of 882 Hz):
First string: E4, 329.63 Hz (bandpass filter settings: lower stop 0.6, lower pass 0.625, upper pass 0.8, upper stop 0.825).
Second string: B3, 246.94 Hz (bandpass filter settings: lower stop 0.51, lower pass 0.535, upper pass 0.57, upper stop
0.595).
Third string: G3, 196.00 Hz (bandpass filter settings: lower stop 0.41, lower pass 0.435, upper pass 0.46, upper stop
0.485).
Fourth string: D3, 146.83 Hz (bandpass filter settings: lower stop 0.3, lower pass 0.325, upper pass 0.35, upper stop
0.375).
Fifth string: A2, 110.00 Hz (bandpass filter settings: lower stop 0.21, lower pass 0.235, upper pass 0.26, upper stop
0.285).
Sixth string: E2, 82.407 Hz (bandpass filter settings: lower stop 0.15, lower pass 0.175, upper pass 0.2, upper stop
0.225).
Components used:

|
|