DXVU Spectrum Analyzer 2.0
xFX JumpStart

What is this?

Spectrum Analyzer is a sample application that demonstrates the tremendous power of the DXVU Meter control by plotting the sampled data in the frequency domain.

The Spectrum Analyzer uses the PeakValues event generated by the DXVU Meter control to acquire chunks of audio samples and processes this audio using the Fast Fourier Transform to represent the frequency response or the captured audio data.

How does it work?

The main application initializes the DXVU Meter control to start capturing audio using an specific sampling rate and resolution.
Every time a new chunk of data arrives through the PeakValues event, this data is passed to a DLL (dynamic link library), also created in Visual Basic, that processes the values and plots the frequency response into a PictureBox object.

The DLL has been design in a way so its easy to use and hides from the developer all the complex stuff of processing the audio data to obtain the frequency response.

Frequency Analyzer Options

The Frequency Analyzer sample application offers features often found on professional applications.
Here's the list of options, their meaning and information on how to use them:

Spectrum Style

Bars Display (): This option produces a bar-type display, where each bar represents the frequency at a given point.

Leds Display (): This options is similar to the bar-type display, but the bars are divided into smaller rectangles mimicking a led display. When using this mode, make sure you keep the FFT Size parameter as low as possible to obtain the best results.

Lines Display (): This is the fastest mode and the resulting graphic shows an envelop where each point represents the frequency at a given point.

Input Gain: This controls the gain of the input audio data. This control is useful to adjust the response of the frequency response and amplify and reduce the resulting graphic.

FFT Size: This sets the number of points that will be used to render the graphic. More points produce better and more accurate results at the expense of more CPU consumption. The optimal value for audio analysis should be 1024. The optimla value for the detection of DTMF tones should be 512.

FFT Window: This option will apply a different method of anti-aliasing (or smoothing) the sampled data by producing a finest frequency response graphic at the cost of some resolution.

Power (): This is the power button. Clicking on this button will turn on the Frequency Analyzer. Clicking it again will turn it off. Remember to turn off the application before closing it.

Sampling Rate: The sampling rate determines the quality of the rendered audio data. The optimum value should be set to 44KHz @ 8bit Mono.

R Button: When using one of the Stereo sampling settings, the application will, by default, capture the audio data from the left channel. Clicking on this button will force it to use the right channel. You can monitor both channels at the same time by launching two instances of the Frequency Analyzer application, setting both instances to sample in Stereo mode and clicking on the R button of one of them.

Options

Show Energy: Clicking this option will display an horizontal line across the display window representing the average energy of the frequencies being rendered.

Hold Peaks: When this option is enabled, the highest peaks for each sampled frequency will be displayed.

Logarithmic Scale: Clicking on this option will set the frequency axis in logarithmic mode. This can be quite helpful when analyzing voice or audio with frequencies under the 2.5KHz.

Use Colorized Scale: When this option is enabled, the rendered graphic will have three different colors depending on the amplitude of each point.

DTMF Detection: When this option is enabled, the application will monitor a set of frequencies that correspond to the digits of a touch tone phone. When one of these frequencies is detected, the corresponding digit will be displayed.

Colors

Graphic: This is the color that will be used to render the graphic when the Use Colorized Scale option is turned off.

Background: This is the color of the background of the display area. When the Use Colorized Scale option is turned on the background will always be black.

Peaks / Energy: This sets the color of the Peaks and Energy graphics when the Use Colorized Scale option is turned off.

Scale Color: These three buttons will let you set the color of the graphic when a point reaches a certain point.

Using the Scale

Frequency Analyzer offers a convenient and versatile scale system that can be adjusted to concentrate the display on a particular range of frequencies.

Once the sampling rate has been set, the application will adjust the scale according to the sampling frequency. The highest possible frequency will always half the sampling rate.

To adjust the minimum frequency drag the leftmost arrow below the main scale.
To adjust the highest frequency drag the rightmost arrow below the main scale.
To adjust the span or frequency range drag the small horizontal line below the main scale.

If you would like to zoom to the set frequency range click on the small magnifier icon to left of the main scale.

When adjusting any of these parameters the scale at the top of the display area, will show the real scale.

Moving the mouse over the display area while holding the SHIFT key will show the frequency and amplitude at the given point.