AVR Atmega audio input RMA using FFT Radix-4

audiogetradix4 is a simple library you can use to interface with a ac audio input.
It reads data from an ADC pin and returns the RMS value of the input using DFT Radix-4 algorithm.
AVR Atmega audio input RMA using FFT Radix-4
The discrete Fourier transform (DFT) converts a finite list of equally-spaced samples of a function into the list of coefficients of a finite combination of complex sinusoids, ordered by their frequencies, that has those same sample values.
I’m not a DSP expert, so if some expert find error in the method i use, explained below, please let me know.
A Radix-4 decimation-in-time (DIT) FFT is a Cooley–Tukey algorithm for computing the discrete Fourier transform (DFT).
My radix4 implementation is a port of RADIX-4 FFT library by Anatoly Kuzmenko.
To obtain RMS value of the AC current of the audio signal processed, from which you can get the SPL db value, we use the Parseval’s theorem for FFT so for fft size of N.
Let’s conside x[i] as the signal, and let’s take N samples, we could take only real part of the signal using our ADC, so we can consider Parseval therorem for DFT.

consider X[k] as the “modified” frequency spectrum, valid from 0 to N/2, and the the first (0) and the last (N/2) element have to be divided by the root square of 2.
We define:

given ReX as the real part, and ImX as the imaginary part of the signal in frequency domain.
So Parseval therorem for DFT became:

Now we know that RMS in time domain is:

Applying the parseval theorem we can compute RMS in frequency domain as:

Because we are computing a discrete signal, we can treat the equation above for DTFT.
So X[k] is not a “modified” frequency spectrum.
So Parseval therorem for DTFT became:

And we can compute RMS in frequency domain as:

Once again as audiogetavarage library here is also implemented a dynamic bias, for the electronic board used during experiment, refer to that project.
This time the TLC272 opamp is used in pre, this ic is a little more sensitive then the TLC27L2 used previously, so a filter caps is added in this pre circuit revision (rev 03).Schematic AVR Atmega audio input RMA using FFT Radix-4
For more detail: AVR Atmega audio input RMA using FFT Radix-4


About The Author

Ibrar Ayyub

I am an experienced technical writer with a Master's degree in computer science from BZU Multan University. I have written for various industries, mainly home automation and engineering. My writing style is clear and simple, and I am skilled in using infographics and diagrams. I am a great researcher and am able to present information in a well-organized and logical manner.

Follow Us:
LinkedinTwitter
Scroll to Top