Question about the Framework (record only when dB high enough)

Jan 16, 2013 at 5:52 PM

I'm building an application where would be interesting to have access to ambient sound. The main problem of this is that the sound file should not be too big. I would like to know if using this framework is possible to actually record audio from a microphone only when the dB is high enough.

 

Obs.: Keep in mind that all the recorded data should go to the same file.

Is it possible to do with this framework?

Coordinator
Jan 16, 2013 at 6:07 PM

sure, you call "StartRecording", but every time a buffer of audio is available (DataAvailable event), you examine the value of each sample. If the volume is greater than a particular threshold, you write the recorded buffer to your WAV file, if not, you simply discard it.

Jan 16, 2013 at 6:23 PM
markheath wrote:

sure, you call "StartRecording", but every time a buffer of audio is available (DataAvailable event), you examine the value of each sample. If the volume is greater than a particular threshold, you write the recorded buffer to your WAV file, if not, you simply discard it.

 

Thank you, man. That's all I had to know

Jan 16, 2013 at 8:28 PM

Do you know how the bytes are sorted? I mean I got to record sound to a .mp3 (there is a less space consuming file type? quality is no issue) but I want to know how the bytes are sorted in the 'buffer' array

Buffer = [MostSig-1,LessSig-1,MostSig-2,LessSig-2,MostSig-3,LessSig-3, ... ] Is it like this? Or how does it work?

 

Thank you.

 

 

Coordinator
Jan 21, 2013 at 6:19 AM

In a WAV file the bytes are little endian (intel byte order) and are interleaved left channel, right channel. In an MP3 file, you cannot access the samples directly. To make MP3, you record as WAV and then convert to MP3 using something like lame.exe

Mark