wlog - a Real-Time Signal Analyzer using Wavelets

ON4CKO - nov 2002

About wlog...

wlog is a tool to analyze signals using wavelets. The wavelet tranformation has the property that it "divides"(or "decomposes") a signal in "smooth" S and a detailed (or "discontinuous") D part. The tool is experimental but can be used to measure the smoothness (and noise-levels) of a signal.

About wavelets...

This section is adopted from the excellent "Amara's Wavelet Page":

The fundamental idea behind wavelets is to analyze according to scale. Indeed, some researchers in the wavelet field feel that, by using wavelets, one is adopting a whole new mindset or perspective in processing data.

Wavelets are functions that satisfy certain mathematical requirements and are used in representing data or other functions. This idea is not new. Approximation using superposition of functions has existed since the early 1800's, when Joseph Fourier discovered that he could superpose sines and cosines to represent other functions. However, in wavelet analysis, the scale that one uses in looking at data plays a special role. Wavelet algorithms process data at different scales or resolutions. If we look at a signal with a large "window," we would notice gross features. Similarly, if we look at a signal with a small "window," we would notice small discontinuities. The result in wavelet analysis is to "see the forest and the trees."

Can you see why these features make wavelets interesting and useful? For many decades, scientists have wanted more appropriate functions than the the sines and cosines which comprise the bases of Fourier analysis, to approximate choppy signals. By their definition, these functions are non-local (and stretch out to infinity), and therefore do a very poor job in approximating sharp spikes. But with wavelet analysis, we can use approximating functions that are contained neatly in finite domains. Wavelets are well-suited for approximating data with sharp discontinuities.

The wavelet analysis procedure is to adopt a wavelet prototype function, called an "analyzing wavelet" or "mother wavelet." Temporal analysis is performed with a contracted, high-frequency version of the prototype wavelet, while frequency analysis is performed with a dilated, low-frequency version of the prototype wavelet. Because the original signal or function can be represented in terms of a wavelet expansion (using coefficients in a linear combination of the wavelet functions), data operations can be performed using just the corresponding wavelet coefficients. And if you further choose the best wavelets adapted to your data, or truncate the coefficients below a threshold, your data is sparsely represented. This "sparse coding" makes wavelets an excellent tool in the field of data compression.

Other applied fields that are making use of wavelets are: astronomy, acoustics, nuclear engineering, sub-band coding, signal and image processing, neurophysiology, music, magnetic resonance imaging, speech discrimination, optics, fractals, turbulence, earthquake-prediction, radar, human vision, and pure mathematics applications such as solving partial differential equations.

The mother wavelet used in this program is known as daub4 (Daubechies bibliography can be found here)

How the tool works

The best thing to do in finding out how the tool works, is to select a Sinus from the Signal menu: This visualises the wavelet analysis of a sinus signal.

Select the 'S-component' item from the Watch menu: This shows the Smooth S part of the signal that is decomposed. Make sure that 'Octave 1' in this menu is selected and you will see a smooth black sinus passing by on the screen.

By adding different octaves on the screen you see the daub4-wavelet decomposition of the smooth part of the signal in different scales. Each octave has its own color.
From octave 7 on, this signal is totally decomposed, leaving nothing but a flat line.

NOTE: You may notice that the higher the octave, the more 'blockier' it becomes. This has to do with the synchronisation as higher octaves signal have less datapoints than the lower levels, causing the effect.
Select the 'Octave 3' from the Synch menu to lock the update speed of the display to a reasonable value.

Now select the discontinuous D component of the signal in the Watch-menu. Run over the different octaves and you see the following important feature of wavelet decomposition: for small octaves, the D(iscontinous) signal is very small (bcs. a sinus is a smooth signal, there is little discontinuity). This signal's amplitude grows for higher octaves, because, as the scale is growing, there is more and more discontinuity. To put it in other words: 'D' stands for the detail; When the scale is sufficient large, then the whole sinus can be seen as a 'detail'. There is a scale where the whole signal is decomposed in the D part: This is octave 6.
There is no D signal left after octave 6, bcs the wavelet decomposition reuses only the Smooth part of the signal.

SINUS/SMOOTH PART - A smooth sinus at scale 1 (block) is decomposed to a block wave (green) until there is no smoothness left and the signal is flat (lightblue)

You can see a similar thing with the square signal in the Signal menu. However, for this signal you must take into account that a square signal is already discontinuous at small scales (ie. low octaves).

SQUARE/SMOOTH PART - A blockwave at scale 1 (block) has already lost its sharp edges (black). It loses more and more of its discontinuity until the signal is almost a sinus (green). In the end, the signal decomposes in a flat line (yellow)

The menu system:


  1. Restart - Restarts the program
  2. Exit


  1. S/D component - Select the Smooth or Detailled (discontinuous) part of the decomposition.
  2. Octave X - Visualize the transformed signal at different scales (or "octaves"). Each octave has its own colour.


  1. Lock scale - wlog uses dynamic scaling to display both small and big signals. This can clash with measurements and introduces a 'dancing' effect on the signal. Use this menu to turn the feature on or off.
  2. Octave X - Select the update speed of the display to match the Nth octave. The higher the octave, the slower the update speed.


  1. Sinus - Select a smooth sinus signal.
  2. Square - Select a block signal.
  3. Microphone - (default) Select the microphone input as the input source (8bit @8KHz MONO).


  1. Double buffer - Fluent (but memory intensive) graphics technique.
  2. Enlarge/Shrink - Larger/smaller display


AUTO SCALING - The signal that is shown on the screen is not the real signal anymore (it cannot be viewed as a denoised signal). So, the only information that can be retrieved from the tool is the amplitude of the signal.

However, since this tool has an auto-scaling function, this kind of comparison is difficult. The amplitude of the signal on the screen is automaticly updated (you can see this as a small fluctuation). Now, to compare noise levels of the signal, the following steps must be taken:

  1. Turn on the auto-scaling and analyze of reference signal with wlog.
  2. Turn the auto-scaling off (w. the menu) and apply the real signal.
Now you can compare the amplitude of the signal (2) with the amplitude of step (1).

RESOURCES - This program is quite heavy for the processor: it takes much of the computing and processing power from the system. This is esp. so when using the microphone as an input device. This is why the sampling of data happens at 8bit Mono @8KHz. It is advisable to increase the sampling rate (and/or adjust the sampling routine) of this program when your PC is fast enough (but you'll have to recompile the tool).

UPDATE SPEED - Wavelet decompition of higher octaves takes some time to compute (this is inherent to wavelet decomp as higher octaves need the data from the lower octaves). Changing a signal input-source make take some time to show effect on the screen.


This tool uses the free Qt v2.x library and portaudio v1.8 library (not needed for the binary distribution).

Source code (needs Qt 2.x and Portaudio v1.8)src (.zip)
win32 buildbin (.zip)
Linux buildbin (.tgz)

ON4CKO - nov 2002