Listening for tones

Aug 21, 2010 at 5:40 PM

Is it possible for me to listen for a specific tone? I am working on an application for a fire department and they send calls out on a scanner. They initialize two tones before the actual message is broad casted. The tones are 352.7 and 345.6, I am assuming this is a frequency. I already have some code written to do the recording but I only want to kick off the actual writing method when these tones are heard. Can NAudio listen for this type of frequency and what are the classes for me to look into? If not are there other library's that can help me do this.



Steven Combs

Sep 6, 2010 at 11:04 AM

I'm afraid NAudio has nothing built in. Fast Fourier Transforms can be used to detect the frequencies contained in a signal. I'm not sure if they are the best way to actually look for a specific frequency though


Oct 16, 2010 at 2:12 PM
Edited Oct 16, 2010 at 2:17 PM

Mark is right about the FFT thing, and there is a relatively fast implementation in C++ here:

Edit: Actually, I did notice that NAudio has an FFT implementation, but when testing it, it was MIGHTY slow. I have ported the code in the link above to C#, and if anyone wants I could clean it up and upload it somewhere. Maybe it could even be put in NAudio.

Oct 16, 2010 at 4:41 PM

Wow, this website has some complicated math functions I am unfortunately not that good yet but ty for the post. This may take a couple months for me to figure out but I should be able to get there.

Oct 16, 2010 at 5:58 PM

Well, to be honest I don't really understand the math too well either, but if you want I can upload the code I use, along with some instructions.

Jan 24, 2011 at 4:23 AM

Hi Bevinsky!

It might be a little late for this but just in case, would it be too much trouble to ask you to share your code regarding the FFT? Im experimenting on working on trying to use it for Chord detection but I cant seem to get Naudio's FFT to work.

Thank you very much!

Mar 17, 2011 at 1:52 PM

Hello Bevinsky!

Same here, would you share your code with us? Thank you!

Mar 18, 2011 at 3:28 PM

bloodfire and edudiego: Here is my C# FFT algorithm. It's full of comments and help for the functions.

Mar 24, 2011 at 3:16 PM

thx bevinsky!

Apr 26, 2011 at 11:07 AM

I've read C# FFT algorithm but how can i pass the int buffer for the transform function?


Apr 26, 2011 at 11:14 AM

have a look at the WPF demo supplied with NAudio to see the FFT algorithm being used