In this topic, we will focus on the design details of a Digital, real-time Audio LED Spectrum analyzer. The aim focuses on building a device to display the distribution of an audio signal energy to 20 specific frequency bands, using DSP technology. We will use fast Fourier transform (FFT) in order to analyze any audio signal in real time. The obtained Fourier transform will result in a bank of 20 parallel frequency filters. The output of the filters will be displayed on a simple 20 x 20 LED display. The unit will be designed to support up to four different display-modes.

For constructional details about building this design on an circuit board, please refer to the Audio Spectrum Analyzer circuit project.

Brief History

The first version of this Digital Audio Spectrum Analyzer appeared during 2007 at the "Microchip Embedded Control Design Contest" as the MT1750 project. It was initially published on Circuit Cellar's website. Soon, this project becomes a favourite one among electronic enthusiasts. This is because, it is not just a good project but it also uses a very clever method for digital signal processing and filtering. Later, the project was published on Circuit Cellar Magazine (issue 244, November 2010).

Keywords: Digital signal processing, fast Fourier transform, frequency spectrum, Hamming window, real and complex vectors, frequency response, filter-bank, bar-graph, display frame and frame rate.


1. Introduction

Spectrum analyzers are employed in most of the modern signal processing systems for measuring the distribution of signal energy in frequency. An audio spectrum analyzer is used for measurements in the audible frequency spectrum (from 0 to 20000 Hz) and can be a very powerful tool for keeping a studio well tuned. Many modern audio devices, such as amplifiers, audio-equalizers, audio mixers and PC-audio players contain a spectrum analyzer, which is used to display an audio frequency spectrogram (the frequency spectrum of the audio signal) on an LCD, CRT or LED display. The spectrogram not only offers a spectacular visual effect but also provides a quick way to inspect the audio performance during playback, recording or during any tonal adjustment (bass, treble, mid frequencies adjustment or adaptive equalization).

A Digital, real-time Audio Spectrum analyzer circuit for audio devices (photo 1) is presented in this project. This circuit is based on a dsPIC30F6012A, which is chosen for a feature set which matches to the requirements for this project. The DSP engine, the 12-bit A/D converter, the timer3 timer, 42 I/O ports and the large internal data memory of the dsPIC30F6012A are used in this project. A quad of dual MCP6022 op-amps for anti-aliasing filtering and gain are also used in the analog section of the circuit.

The Digital, real-time Audio Spectrum analyzer circuit for audio devices can be connected to any audio device. It accepts an analog audio signal as input. It digitizes and processes this audio signal using a DSP. It computes the distribution of the audio signal energy to 20 specific frequency bands and displays it on a 20x20 LED display. Everything is done in real time.

The Digital, real-time Audio Spectrum analyzer circuit for audio devices supports 4 display-modes. The audio frequency spectrogram (the distribution of the audio signal energy) can be displayed in any of these 4 display modes:

  1. “Bars” (It is a real – time bar graphs plot)

  2. “Bars + peaks” (It is a real – time bar graphs plot with the peak being hold for a some time)

  3. “Climbing Bars” (It is a “slow” bar graphs plot. The bars are “climbing” to the peak. After this, they fall at a constant rate until a greater peak comes up)

  4. “Climbing Bars + Rain” (It is a “slow” bar graphs plot which gives the sense of “Rain”. The bars are “climbing” to the peak and the peak is being hold. After this, the bars fall at a constant rate A and the peaks fall at constant rate B until a greater peak comes up. It is A>B)


The distribution of the audio signal energy is plotted in 20 bar – graphs. Each bar-graph consists of 20-Leds. The bar-graph plots cover a dynamic range of 27db with 1.3db resolution. These details are presented in photo 2.

The design procedure of the system is presented section 2. The system’s hardware and software are presented in section 3 and 4 respectively. Some performance measurements of the system are presented in section 5.

Photo 1. The Digital, real-time Audio Spectrum analyzer circuit for audio devices

 

 

 

Photo 2. The distribution of the audio signal energy is plotted in 20 bar – graphs. 4 display-modes are supported (This photo was taken during normal operation at “Bars” display mode)

 

 

2. The design procedure

 

The following have been taken into account, during the design procedure:

  1. The audio frequency spectrum analyzer has to cover the 0 – 20000Hz frequency band.

  2. The spectrogram is displayed in 20- bar graphs.

  3. Each bar graph displays the total signal power level in a specific spectral band. As such, there are 20 spectral bands and we need 20 band-pass filters.

  4. Each bar graph consists of 20 LEDs

  5. The audio frequency spectrum analysis must be performed and displayed in real time.

  6. We must use antialiasing filters of less or equal to 5th order (for circuit-size reduction).

 

Designing step 2.1:

We need 20 band-pass filters in order to decompose the input signal into a set of 20 sub band signals. Which must be the central frequency of each band-pass filter?

Answer: There is no need to display any spectral components with resolution greater than 30Hz at the lower bound of the audio spectrum because the human ear has not any great resolution at these frequencies. Thus, we choose 31Hz, 62Hz and 93Hz to be the central frequency of the 1st , 2nd and 3rd filter respectively:

, ,

(2.1)

There is also no need to display any spectral components with resolution greater than 5KHz in the upper bound of the audio spectrum. Thus, we chose 15KHz to be the central frequency of the 20th filter.

(2.2)

Considering the octave tonality sense of the human ear, the best way to find the central frequencies for the 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 and 19 filters is solving equations (2.1) - (2.2) and (2.3).

For i=4,5,6 … 20. Where a, is a constant fraction of the octave

(2.3)

By solving (2.1), (2.2) and (2.3) we obtain: octaves and

Table 1. The central frequency of each filter

i

CF(i)

 

i

CF(i)

1

31 Hz

 

11

1024 Hz

2

62 Hz

 

12

1380 Hz

3

93 Hz

 

13

1862 Hz

4

126 Hz

 

14

2510 Hz

5

170 Hz

 

15

3386 Hz

6

230 Hz

 

16

4565 Hz

7

310 Hz

 

17

6155 Hz

8

420 Hz

 

18

8300 Hz

9

563 Hz

 

19

11200 Hz

10

760 Hz

 

20

15000 Hz

 

Designing step 2.2:

We must implement 20 band-pass filters in order to decompose the input signal into a set of 20 sub band signals. Is it possible to be done with a DSP in real time?

Answer: Considering the required filter’s order (which is greater than 8 in low frequencies in order to achieve 30 HZ resolution) and the DSP’s speed (up to 30MIPS) it is impossible to be done in real time using FIR or IIR approach. The only way is FFT (Fast Fourier Transform).

 

Design problem 2.3:

Which must be the length of the FFT and the sampling frequency in order to achieve the required frequency resolution?

Answer: Considering table 1, we need a frequency resolution of 30Hz. The frequency resolution depends on the FFT’s length and the sampling frequency. For a N-points FFT the frequency resolution df is:

 

(2.4)

On the other hand, the sampling frequency must comply with the Nyquist sampling theorem, which indicates that a continuous signal can be properly sampled, only if it does not contain frequency components above one-half of the sampling rate:

 

(2.5)

For an audio signal, the fmax is limited to 20 KHz by appropriate filtering. This way, the Nyquist limit is at 40KHz. In order to avoid using large anti-aliasing filters, it is better to set a sampling frequency much greater than the Nyquist limit. Using a 5th order Butterworth antialiasing filter, over-sampling at 80KHz is a sufficient rate. From equation (2.4) we conclude that N must be greater than 2667 in order to achieve 30Hz resolution at a sampling frequency of 80KHz. Actually, the N must be greater than 4096, because it can only be a power of 2.

A 4096-points FFT cannot be implemented using a dsPIC in real time (mostly due to fractional nature restrictions). On the other hand, there is no need for 30Hz resolution at frequencies above 126Hz, as it can be seen from table 1. The solution to the problem is the use of 2 different sampling rates, 2 x 256points-FFTs and 2 antialiasing filters as shown in figure 1:

Figure 1. The answer to the design problem 2.3 (The actual sampling frequencies, which are used in the project, are 7998.6981 Hz and 87252.071Hz respectively and they provide a frequency resolution of about 31.25Hz and 340.83 Hz.)

As it can be seen from figure 1 and table 1, the 1st FFT can provide the resolution needed for the low frequencies, while the 2nd FFT provides a very good resolution for frequencies over 1KHz. Of course, the solution, which is presented in figure 1, is not the only possible one to the problem but it works perfect with the dsPic.

 

Designing step 2.4:

We must decompose the input signal power into a set of 20 sub band signals. To do so, we must use 20 band-pass filters, each one having a CF(i) central frequency as indicated in table 1. Each sub-band signal must represent the total input signal power of each spectral band and will be displayed on a 20-LED bar graph. How can we do this with FFT and figure 1?

Answer: We need a Filter-Banking algorithm in order to implement a 20 non uniform-band parallel analysis filter- bank using FFT. We must use some mathematics to do this:

Consider the case when a single tone S of unity magnitude (0db), at frequency f, is applied to the input of the device. This tone will be sampled with a SR sampling frequency. This will result in a sampling sequence S(n, f, SR) as described in equation (2.6):

, n=0,1,2,3….., pi=3.14….

(2.6)

Consider the case that we store the first 256 samples of this sequence in memory and we apply a 256-points, normalized to 0.5 Hamming window w(n). This results to Y(n, f, SR):

, n=0,1,2 …..255

(2.7)

 

(2.8)

Afterwards, we apply a 256-points Fast Fourier Transform to Y(n, f, SR), which result in X(n,f,SR):

 

(2.9)

Notice that S(n, f, SR) , w(n) and Y(n,f,SR) are real signals and X(n, f, SR) is a complex signal. Next we compute the square magnitude of X(n,f,SR) and we take P(n,f,SR) which is the discrete digital representation of the signal power in frequency domain.

 

(2.10)

Next we define Bar0(f), Bar1(f), ……. Bar19(f), from P(n,f,SR) as above:

 

(2.11)

(2.12)

(2.13)

(2.14)

(2.15)

(2.16)

(2.17)

(2.18)

(2.19)

(2.20)

(2.21)

(2.22)

(2.23)

(2.24)

(2.25)

(2.26)

(2.27)

(2.28)

(2.29)

(2.30)

Where SR1, SR2 are the sampling frequencies 7998.6981 Hz and 87252.071 Hz, respectively.

 

Next, we plot Bar0(f), Bar1(f)……Bar19(f):

 

(Y axis: db, X axis: Frequency in Hz)

 

Plot 1,2. The 20 filters, each one having a central frequency CF(i) according to table 1


As can be seen from plots 1 and 2, Bar0(f), Bar1(f)…….Bar19(f) are 20 band-pass filters, each one having a central frequency CF(i) according to table 1. Thus, we have implemented a 20 non uniform-band parallel analysis filter- bank with FFT. The 20 filters are overlapping at half power points (-3db below peak). Filters 4-9 and filters12-19 are Flat-top at -16db. Filters 0,1,2,3,10 and 11 have 1db more loss than the others.

In conclusion, in order to implement the desired filter bank using FFT and Figure 1 we must follow the steps below:

  1. Acquire 256 samples of the audio signal at SR1=7998.6981 Hz sampling rate.
  2. Apply a 256-points Hamming window to them.
  3. Compute the 256-points FFT of the resulting vector.
  4. Compute the square magnitude vector P, of the resulting vector X.
  5. From Vector P, we compute Bar0, Bar1, Bar2, Bar3, Bar4, Bar5, Bar6, Bar7, Bar8 and Bar9 samples.
  6. Acquire 256 samples of the audio signal at SR2=87252.071Hz sampling rate.
  7. Apply a 256-points Hamming window to them.
  8. Compute the 256 points FFT of the resulting vector.
  9. Compute the square magnitude vector P, of the resulting vector X.
  10. From Vector P, we compute Bar10 Bar11, Bar12, Bar13, Bar14, Bar15, Bar16, Bar17, Bar18 and Bar19 samples.


After following these steps, we can simply plot each Bar-sample to a Led Bar-graph and we have a 20-bands audio Spectrum Analyzer. The dsPIC30F6012A has enough memory and speed in order to perform steps 1 to 10 in real time.

NOTE 1: The Hamming window must be normalized to 0.5, if we use a fractional DSP because Y(n,f,SR) must be less or equal to 0.5 (due to fractional FFT restrictions)

NOTE 2: The audio signal is a combination of many simple tones, which have random phase (phase doesn’t concern us). This is why there is no phase term in the equation (2.6). We just want to compute the total power included in each of the 20, spectral bands.

NOTE 3: Bari is the total power included inside the i band. Without the use of a Window we could not achieve flat-top behavior and we would also have too much noise. Any window can be used instead of the Humming’s, but this will change the filter’s-loss and sharpness. The Hamming window offers the less possible loss.

NOTE 4: The FFT results in significant reduction of the dynamic range, in a fractional DSP. This is due to fractional arithmetic restrictions during FFT computation. For a 256-points FFT, the dynamic range of the Bar samples is almost 30db. This is why the dynamic range of the Digital, real time Audio Frequency Spectrum Analyzer for audio devices is limited to 30db.

 

Designing step 2.5:

We must plot each Bar-sample in a LED bar graph. We have 20 bar samples, thus we need 20 bar graphs. How can this plotting be done?

Answer: First of all we must decide how many LEDs we want to have in each Bar-graph. In this project we use 20 LEDs in each bar graph. This way, we need 20x20=400 LEDs in order to display the 20-band spectrogram. If we decide to drive these LEDs simultaneously we will need 400 I/O pins and a total current of about 8A which, of-course, is not a very good solution. Instead of driving all the LEDs simultaneously, we can use 40 I/O pins in order to drive these LEDs in a bar-sequence mode. We will use 20 I/O pins for X, and 20 I/O pins for Y driving as showed in figure 2. Thus, the total current is limited at about 400mA. Of course, the display frame-rate must be up to 50 frames/sec in order to have a non-blinking image.

Figure 2. Display solution

 

The dsPIC30F6012A can do both DSP and Displaying in real time but it cannot drive the LEDS with the current needed. That’s why some current drivers must be used.

 

3. The Hardware

We can design a block-diagram of the Digital, real time Audio Frequency Spectrum Analyzer by taking into account the issues that have been mentioned in section 2. This block-diagram is presented in figure 3.

Figure 3. Overall System Block Diagram

A display – mode selection capability based on a dual dip-switch has been included in this diagram. Using the switch, the user is able to choose between different display modes. Four (4) different display modes (ways) are supported in this project. These display modes are:

  1. Bars (It is a real – time bar graphs plot)

  2. Bars + peaks (It is a real – time bar graphs plot with peak hold)

  3. Climbing Bars (It is a “slow” bar graphs plot. The bars are “climbing” to the peak. After catching the peak, they fall at a constant rate until the next peak becomes greater than the current state. Otherwise they continue falling.

  4. Climbing Bars + Rain (It is a “slow” bar graphs plots which gives the sense of “Rain”. The bars are “climbing” to the peak and the peak is being hold. Then, the bars fall at a constant rate A and the peaks fall at a constant rate B until a greater peak comes up. It is A>B.)

 

 

3.1 The anti -aliasing filters

The anti aliasing filters have been designed using Microchip’s FilterLab software. They have been designed for a 2KHz and 16KHz cut-off frequency respectively, with a signal to noise ratio better than 30db. Because of the limited dynamic range of the Spectrum Analyzer, which is about 30db, any noise below this threshold (-30db) will not be displayed (will be ignored). Assuming this and due to over-sampling the filters order is reduced to 5.

Figure 4. The 1st anti-aliasing filter (snapshots from Microchip’s FilterLab)

 

Figure 5. The 2nd anti-aliasing filter (snapshots from Microchip’s FilterLab)

 

3.2 Schematics

The system consists of 2 boards, the main-board and the display-board. Every unit in figure 3, except for the display, is located at the main board. The complete schematics of the Digital, real-time Audio Frequency Spectrum Analyzer, are presented below:

Figure 6. The main-board schematic

 

 

Figure 7. The analog-section schematic, in detail

 

 

Figure 8. The display schematic

 

 

Microchip 16-bit Embedded Control Design Contest Entry # MT1750

Digital, real-time Audio Frequency Spectrum Analyzer for audio devices

Materials list:

 

Qty Description Ref Des

 

1 Microchip dsPIC30F6012A IC1

3 ULN2803 – Darlington transistor array IC2, IC3, IC4

4 Microchip MCP6022 dual op-amp IC5, IC6, IC7, IC8

20 BC337 NPN transistor Q1, Q2, Q3, ... Q20

20 20 – LED Bar – graph * BAR1, BAR2, …BAR20

1 14.74560 MHz Crystal Y1

 

20 1K SMD resistor R1, R2, R3 … R20

20 0 – 180 Ohm ** 1/2W resistor R21, R22 … R40

3 10K 5%, 1/4W resistor R42, R43, R44

1 6.98K 1%, 1/4W resistor R45

1 3.48K 1%, 1/4W resistor R46

1 18.7K 1%, 1/4W resistor R47

1 8.87K 1%, 1/4W resistor R48

1 6.49K 1%, 1/4W resistor R49

1 3.09K 1%, 1/4W resistor R50

1 7.87K 1%, 1/4W resistor R51

1 17.4K 1%, 1/4W resistor R52

1 16.9K 1%, 1/4W resistor R53

1 15.8K 1%, 1/4W resistor R54

2 4.7K 5%, 1/4W resistor R55, R56

1 47K 5%, 1/4W resistor R57, R58

2 10 Ohm 5%, 1/4W resistor R41, R59

1 100K trimmer P1

 

2 22pF ceramic capacitor C1, C2

6 10nF SMD capacitor C4, C5, C6, C7, C8, C9

6 100nF SMD capacitor C3, C10, C11 ... C14

4 100nF multi-layer capacitor C20, C21, C22, C23

1 56nF mica capacitor C24

3 4.7nF mica capacitor C25, C32, C35

2 8.2nF multi-layer capacitor C26, C36

3 680pF ceramic capacitor C27, C28, C33

6 1uF / 10V electrolytic capacitor C29, C15, C16 … C19

2 10uF / 10V electrolytic capacitor C30, C31

1 1.2nF multi-layer capacitor C34

 

1 Dual dip-switch S1

4 20-pin connection-header J1, J2, J4, J5

1 2-pin connection-header J3

 

Note: Capacitors are 5%, unless specified.

* Any LED type can be used

** The value of R21-40 resistors depends on the LED type (0 ohm used in this project for common brightness 18mA LEDs)

Photo 1. The complete assembly (The main board is located at the center of the photo. The display is at the top. A 5V/1.5A power supply unit is on the left – not included in the project)

 

4. The Software

The software has been developed in C, using Microchip’s C30 Compiler and functions provided in the DSP library. The source code is located in 3 files:

1. common.h This file contains some global definitions

2. ADC.c This file contains two functions - ADC_Init() and _ADCInterrupt().

 

void ADC_Init(char mode);

void __attribute__((__interrupt__)) _ADCInterrupt(void);

 

ADC_Init() is used to configure A/D to convert 16 samples of 1 input channel per interrupt. The A/D is set up for a sampling rate of 7998.6981 Hz (mode=1) or 87252.071 Hz (mode=2). Timer3 is used to provide sampling time delay. The acquired and converted input pins are AN8 (for mode=1) and AN9 (for mode=2).

 

_ADCInterrupt() is the A/D interrupt service routine (ISR).

 

3. Audio Spectrum.c This file contains 15 functions:

 

int main (void);

This is the main routine.

 

void ConvertToComplex(void);

This function is used to convert the real input sampling sequence into a Complex array by simply zero out the imaginary part of each data sample.

 

void Filter_Bank(unsigned int Samplesflag);

This function computes the Bar0, Bar1, …Bar19 samples according to equations (2.11) and (2.30). SamplesFlag=1 or 3 for 7998.6981Hz or 87252.071 Hz sampling rate, respectively.

 

void FindPeakHold(void);

Used for the "Bars+Peaks" display mode.

 

void FindSnapToPeak(void);

Used for the Climbing-Bars display mode.

 

void initializeIO(void);

Initializes IO pins.

 

void initialize_rest(void);

Initializes arrays.

 

void FindClimbingBars_Rain(void);

Used for the “Climbing-Bars+Rain” display mode.

 

unsigned int display_mode(void);

Returns the current display mode (0-3) according to S1 switch. There are 4 display modes: 0-Bars, 1-Climbing-Bars+Rain, 2-Bars+Peaks, 3-Climbing-Bars.

 

void display (unsigned int dis_mode);

This is the display routine. It displays the real-time spectrogram in the 20x20 LED display. It supports the 4 display modes.

 

void Set_Y (unsigned int x);

Sets Y (figure 2) for the x bar-graph. It is used for the “Bars” display mode).

 

void Set_Y_Peak (unsigned int z);

Sets Y (figure 2) for the z bar-graph. It is used for the “Bars+Peaks” display mode).

 

void Set_Y_SnapTP (unsigned int n);

Sets Y (figure 2) for the n bar-graph. It is used for the “Climbing Bars” display mode).

 

void Set_Y_Rain(unsigned int j);

Sets Y (figure 2) for the j bar-graph. It is used for the “Climbing Bars + Rain” display mode).

 

fractional add_Elements(int num, fractional* point);

Returns the sum of num subsequent elements of a fractional vector (point, points to the first element).

 

The most important routines of this project are presented in detail, below:

 

4.1 The main routine

The main routine of the program uses interrupt driven state-machine logic. The main routine is interrupt driven from the A/D converter. The 12 bit A/D converter acquires NUMSAMP=256 samples from the AN8 and AN9 pins at a sampling rate of 7998.6981 Hz and 87252.071 Hz respectively and puts the A/D conversion results to the real part of the complex inputSignal[] vector. The inputSignal[] vector is processed by means of Windowing, Fast Fourier Transform and Square-magnitude (power) computation. The discrete power spectrum of the audio signal is stored in the Power_Vector[] vector. The Bar samples are computed according to equations (2.11) (2.30) and the results are stored to the Bar[] array. The latter is done during the execution of the Filter_Bank routine. Each Bar-sample is plotted to a Led Bar-graph when the display routine runs.

 

The flowchart of the main routine is presented below:

 

Flowchart 1. The main routine

 

 

Code sample 1. The main routine

 

 

NOTE 1: The inputSignal[] vector is a NUMSAMP*2 – points complex (fractcomplex) vector. The real part of this vector contains NUMSAMP samples of the audio signal. The imaginary part of this vector is set to zero during initialization (when initialize_rest() runs).

In order to apply a NUMSAMP-points Hamming window to the Real part of the inputSignal[] using the VectorMultiply function from the DSP library, we need a NUMPSAMP*2-length, real Hamming window. Thats why the HammingFactors[ ] vector, which contains a real Hamming window, have a NUMPSAMP*2 length.

NOTE 2: The FFTComplexIP function requires the magnitude of the source complex vector to be in the range [-0.5, 0.5]. This is why the HammingFactors[] vector is normalized to 0.5 during initialization.

NOTE 3: The resulting transform from FFTComlpexIP is stored in bit reverse order. Because of this, BitReverseComplex must be applied before the square-magnitude computation.

NOTE 4: The SamplesReadyFlag variable and the p_inputSignal pointer are accessed and modified both from the main routine and the interrupt service routine.

 

 

4.2 The A/D interrupt service routine (ISR)

Timer3 is used to provide timing for the 12bit ADC. The 12-bit ADC causes an interrupt at the completion of the conversion for each 16th sample. The sampling rate is changed every time ADC_Init(char mode ) runs.

 

Flowchart 2. The A/D interrupt service routine (ISR)

 

 

4.3 The ADC_Init routine

ADC_Init(char mode) is called directly from the main routine. It is used for the A/D to convert 16 samples of 1 input channel per interrupt. The A/D is set up for a sampling rate of 7998.6981 Hz (mode=1) or 87252.071 Hz (mode=2). Timer3 is used to provide sampling time delay. The acquired and converted input pins are AN8 (for mode=1) and AN9 (for mode=2).

Code sample 2. The ADC_Init routine

 

 

4.4 The Filter_Bank routine

The void Filter_Bank(unsigned int Samplesflag) routine is called directly from the main routine. This function computes the Bar0, Bar1, …Bar19 samples according to equations (2.11) to (2.30). SamplesFlag=1 or 3 for 7998.6981Hz or 87252.071 Hz sampling rate, respectively.

Flowchart 3. The Filter_Bank routine

 

NOTE: The Filter_Bank routine computes the Bar samples from the Power_Vector , vector and utilizes the add_Elements routine.

 

 

4.5 The Display routine

The void display (unsigned int dis_mode) plots the Bar0, Bar1, ….Bar19 samples in the 20x20 LED display. It is called from the main routine. The LED display consists of 20 LED bar-graphs. Each LED bar-graph consists of 20 LEDs. Each BarX sample is plotted in the X LED-bar graph. This is done sequentially (the Bar0 sample is plotted first, then the Bar1 is plotted, … and finally the Bar19 is plotted). One display frame is completed every time when the display routine returns. The display routine plots only one frame per call. The user cannot understand that every moment only one Bar-graph is active (when the user watches the screen, he sees all the Bar-graphs active), because there are more than 50 frames per second (the display routine is being called more than 50 times per second). The display routine supports four display modes:

  1. Bars (It is a real – time bar graphs plot)

  2. Bars + peaks (It is a real – time bar graphs plot with peak hold)

  3. Climbing Bars (It is a “slow” bar graphs plot. The bars are “climbing” to the peak. After catching the peak, they fall at a constant rate until the next peak becomes greater than the current state. Otherwise they continue falling.

  4. Climbing Bars + Rain (It is a “slow” bar graphs plots which gives the sense of “Rain”. The bars are “climbing” to the peak and the peak is being hold. Then, the bars fall at a constant rate A and the peaks fall at a constant rate B until a greater peak comes up. It is A>B.)

 

Flowchart 4. The Display routine

 

 

Flowchart 5. The “Climbing Bars” display mode (display routine)

 

 

Flowchart 6. The “Bars” display mode (display routine)

 

 

Flowchart 7. The “Climbing Bars + Rain” display mode (display routine)

 

 

 

Flowchart 8. The “ Bars + Peaks” display mode (display routine)

 

 

5. The measured system’s performance

The performance of the system has been measured using a HAMEG HM 8030-5 function generator and a PICO ADC-212 Virtual Instrument (oscilloscope and spectrum analyzer). Some of the measurements are presented below:

Figure 9. Test configuration

 

 

Photo 3. Snapshot from the measurement procedure

 

Photo 3 was taken during the device’s test. A single 310 Hz audio tone is applied to the input of the device under test and the PICO instrument at the same time. We can see that the device under test displays 0db at the 7th bar graph (from left to the right), which is correct as expected. At the same time the PICO instrument gives the following spectrogram:

Figure 10. The spectrogram, which has been taken with the PICO instrument (256 – points FFT , Hamming window).

 

 

The device under test cannot display the 2nd harmonic at 620Hz because it is below –30db (The dynamic range of the Digital, real time Audio Frequency Spectrum Analyzer is from 0 to almost -30db)

Photo 4. Snapshot from the measurement procedure

 


Photo 4 was taken during the device’s test. A single 63 Hz audio tone is applied to the input of the device under test. We can see that the device under test displays 0db at the 2nd bar graph and -7.8db at the 1st and the 3rd bar graph (from left to the right). This is due to the fact that there is a poor frequency resolution capability from 0 to 100Hz due to the overlapping effect of the1st, 2nd and 3rd filter (Plot 1,2).

 

Photo 5. Snapshot from the measurement procedure

 

In photo 5 a single 170 Hz audio tone of a –20 db magnitude is applied to the input of the device under test and the PICO instrument at the same time. The device under test displays –19.5db at the 5th bar graph (from left to the right), which is correct. At the same time the PICO instrument gives the following spectrogram:

Figure 11. The spectrogram, which has been taken with the PICO instrument (256 – points FFT , Hamming window) during the measurement of photo 5.

 

 

Photo 6. Snapshot from the measurement procedure

 

In photo 6, a single 3350 Hz audio tone of a –10 db magnitude is applied to the input of the device under test and the PICO instrument at the same time. The device under test displays –10.5db at the 15th bar graph (from left to the right), which is correct. At the same time the PICO instrument gives the following spectrogram:

Figure 12. The spectrogram, which has been taken with the PICO instrument (256 – points FFT , Hamming window) during the measurement of photo 6.