It reads data from an ADC pin and returns the RMS value of the input using

**DFT Radix-4**algorithm.

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 the 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).

As a tips, i would like to recomend you The Scientist and Engineer's Guide to Digital Signal Processing to study in deep DSP, some of the math above is from this book.

Setup parameters are stored in file audioget.h

This library was developed on Eclipse, built with avr-gcc on Atmega8 @ 8MHz

**Code**

**Notes**

- read risk disclaimer
- excuse my bad english

## No comments:

## Post a Comment