Most of the Hi-Fi audio systems come with a fantastic display that provide music listeners with cisual representation of sound data that shows the strength of different frequencies of the music.These systems use bandpass filters to detect peak valuea at different frequencies. There are multipl ways to implement the audio spectrum function:
Figure 1: Frequency Spectrum Analyzer Display as Typically Seen on a Hi-Fi Audio System
- Analog Filter
The Op-Amp can be designed to create a hardware analog bandpass filter as shown in Figure 2. Several components, such as capacitors and resistors are needed to design a one-band filter. Therefore, the Op-Amp circuit will need more PCB space to implement a multiband audio spectrum system.
Figure 2: Bandpass Filter Circuit
- Audio IC (Integrated Circuit)
Semiconductor manufacturers have some audio spectrum Analyzer ICs on the market. One of the chips that is easy to use is the MSFEQ7. It is a seven-band graphic equalizer COMS chip and all it takes is just a few extra components to build a seven-band spectrum. The circuit diagram is shown in Figure 3.
Figure 3: MSGEQ7 Circuit Diagram
- Digital Filter
A digital filter uses a digital processor to perform numerical calculations on sampled values of the signal. The analog input signal must first be sampled and digitized using an ADC (Analog to Digital Converter). The resulting binary numbers are transferred to the microprocessor, where numerical calculations are performed. A block diagram for the basic digital filter is shown on Figure 4.
Figure 4: A Block Diagram of a Basic Digital Filter
The AUDIOSPECTRUM object is used for making a simple spectrum Analyzer with a PSoC 5LP. It uses software algorithm to divide the input audio spectrum into 7 bands, 63Hz, 160Hz, 400Hz, 1KHz, 2.5KHz, 6.25KHz and 16KHz. The "AudioSpectrum" object needs to be linked with the following PSoC components: OPAMP, ADC-SAR, Interrupt, and 48KHz Clock signal. The default CPU frequency for PSoC 5LP is 24MHz. It is too slow to handle the heavy computation for the digital filter, so you need to increase the CPU frequency to 67MHz or 80MHZ (the maximum frequency is based on the PSoC 5LP chip that your board offers). You can read this article to understand how to change the CPU frequency.