Introduction

This project demonstrates an implementation of the waterfall spectrogram and use of statistical data to trigger events in near real-time. This code is an elaboration of my previous submission (SoundViewer). This demonstration utilizes the Wave classes developed by Ianier Munoz.

Using the Code

Audio is supplied by the default input device which is typically the microphone. Events are triggered when audio amplitude exceeds the desired threshold value, which can be set under Options on the menu bar. To make this more useful, I've added functionality to save the stream to disk which results in a nice sound activated recorder.

Points of Interest

In order to draw the spectrogram fast enough to allow for near real-time operation, I needed to write directly to memory using unsafe code.

I am able to get the audio from wavOut class and process them to get the various displays. But there is a lot of noise. How do I reduce it? Also, the Time Domain Display does not show any significant variation of amplitude. Any way out?

Could you give me some directions to input the wav file data to the program instead of the inline mic? I can get the format of the file. But thereafter, how do I get the audio frames of the file input for FFT?
Also, is it possible to do band pass filtering in this code?

To make a band pass the filter, simply put the FFT with the value zero on the frequencies that you don't wish. For example, if you want the human voice (it's more and less 130-1100Hz). You can convert to Hz using the scaleHz on the values of the FFT array.

To get the audio frames you will have to do the inverse of the FFT calculated (IFFT).
I want this as well :P If he answers me or you find out, please post here.

I'm not sure about this but I suspect there's a problem with your frequency spectrum. I've set your 'test' flag to true so that it works on a simple sine wave and the spectrum shows a dominant frequency with side content indicating the presence of other frequencies which simply aren't there. You should see a _single_ spike in the spectrum corresponding to the frequency of the sine wave being transformed. Otherwise, great job

What frequency? I think I may have corrected this in a later revision that I didn't post. It was a rounding error in drawing the wave if I remember correctly. I'll try to find the correction and post it here. Thanks for the constructive critcism.