# Using Discrete Wavelet Transform in the time-frequency domain

I am creating an application that works like the Shazam service. In short, my goal is to create an audio pattern matching service. However, I would like to use DWT and not the short time Fourier transform.

I am faced with some problems interpreting the results of the DWT. In particular I have the following questions:

1. How to plot the results of dwt like a spectrogram?
2. How to determine what frequency prevails in a given time?
• Kind of the same question as dsp.stackexchange.com/q/651/29 Also, I think only sinusoidal wavelets like Morlet have a true frequency? – endolith Dec 12 '12 at 17:24

Generally below intensity of the color will tell you about importance of a frequency. Some programming languages have this functionality built in. Let's take for example Mathematica (has free trial). Let's import some sample recording:

voice = ExampleData[{"Sound", "Apollo11ReturnSafely"}]


Here is built in Spectrogram function:

s = voice[[1, 1, 1]]; r = voice[[1, 2]];
Spectrogram[s, SampleRate -> r]


with time on horizontal and frequencies on vertical axes. For wavelets though it is more natural to use Scalogram. Here is built-in function WaveletScalogram:

cwt = ContinuousWaveletTransform[voice, GaborWavelet[6]];
WaveletScalogram[cwt, ColorFunction -> "AvocadoColors", ColorFunctionScaling -> False]


Scalogram can provide useful info. For example it is great for visualizing voice versus noise feature. Voice is more rich and irregular in structure, noise is more monotonic and repetitive. Horizontal axis is time. Vertical axis is octaves. Higher frequencies are resolved at lower octaves and lower frequencies at higher octaves.

For DWT you will have a similar plot:

cwt = DiscreteWaveletTransform[voice];
WaveletScalogram[cwt, ColorFunction -> "AvocadoColors", ColorFunctionScaling -> False]


• Thank you. Can you explain me how to plot scalogram in general when I have dwt coefficients only? How to obtain intensities at given time moment(vertical line in plot)? – rayman Dec 9 '12 at 12:09