Link to home
Start Free TrialLog in
Avatar of CDirenzi
CDirenziFlag for United States of America

asked on

Filter data from A to D by frequency

I have a data file, that contains a list of audio volume levels from an audio source that has been sampled with an A to D converter.  The levels were sampled at a rate of about 200,000 times per second.  The file contains a list of 10 bit integers that correspond to voltages: 0 is 0 volts and 0x03FF is 3.3 volts. I need to sort the data based on the frequency, where 300-4000 Hz goes into one list and the rest goes into another.  Is there any way I can obtain frequency information from the sample rate and the level?  I have to do it in C.

 It seems like a fourier transform or one of those, but it has been many years since I have taken that in school.  Thanks!!
Avatar of d-glitch
Flag of United States of America image

If you are trying to eliminate noise, you need to implement a digital filter.  Here is an introductory link:

This is a very active research area.  You should be able to find lots of stuff on line.

By far the easiest way to do this would be with MATLAB.

If on the other hand you are trying to do a frequency analysis, you will need to implement an FFT (Fast Fourier Transform).

Once again, lots of links and a built-in function with MATLAB.

Are you trying to convert audio volume levels to frequencies ? How does volume relate to frequency ? Am I misunderstanding you ?
Avatar of CDirenzi


Yes, I am basically trying to eliminate noise, but there is a little more than noise, I'm trying to remove a few particular frequencies.  I used to use MATLAB for FFTs (it's been a while but if I remember right it's really easy), but I have to use C... This program is going to eventually be put on a microcontroller.  I looked at the filter algorithm from netrino, I'm going to try it, but I'm afriad I'm going to have to do a FFT.  Any chance you know of any code that I can use in C that will allow me to do one like in MATLAB?  
A little more info on exactly what you're doing would be helpful.

What is your data?  Machine vibrations, conversations, bird calls?  
Is it just this one file?  

Are you always going to be processing stored data, or are you trying to move towards real-time audio signal processing?

After you process the data to get two lists/files (300-4000 Hz) and (everything else),
what are you going to to with them?  Does one of them get thrown away?

You might want to look at the PIC microcontrollers from Microchip.  They have chips targeted for DSP applications, and lots of sample programs.

If you want to remove noise, you need a filter not an FFT.

You might need to do an FFT on sample date to find out where the noise is so you can design your filter.  You could use MATLAB for that.
The data will always be volume levels, and I hope to move to real time, but it is not absolutely necessary- if I have to I can sample every quarter of a second or so.  The mic is going to be stuck under walkways, so I need to filter things like foot steps as well as your normal noise.  The second list, 'the other stuff' will probably get thrown away, but for now I am saving it for data collection.  I pretty much have my heart set on the pic 24fj16ga002 for cost reasons.
That chip certainly has significant processing power available.

Are you planning on using the A/D in the PIC?

Since you only care (in some sense) about frequencies up to 4 kHz, you might be better off putting a sharp, analog anti-alias filter before the A/D and sampling at a lower rate.  This will reduce the computational load enormously.

How are you planning to store the processed output data?
Avatar of d-glitch
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial