Windows 7, voice recorder

Mar 29, 2010 at 11:35 PM
Edited Mar 30, 2010 at 3:20 AM


I have been trying to use the voice recorder code, , to simply record and play back wav files. I did the following things : 

1. Attached the VoiceRecorder.Audio files with my project, adding references to NAudio.

2. Making the project x86

3. testing out the code for simple things like selecting recording device, handling volume, microphone sensitivity, recording, replaying and transcoding using Lame. I have a number of queries: 


A.  Simplest one first, when I use Lame a dos windows pops open, since the exe is being run. Is there any way to suppress that ? 

B. I am not able to handle volume or microphone sensitivity, because "control" is cribbing.

C . most importantly, when I try to record, playback, at best I get a momentary recording ( 46 bytes)  or a short burst of the starting of the audio file( less than 1s ).

D. When I tried debugging, the thread passes control onto the next statement immediately. I tried sleeping the thread, putting an infinite loop, etc but at best I am able to get a momentary recording or playback. 


I am almost a newbie to C#, forgive me for the simplistic issues. I would appreciate it very much if you can help me out in any way, to perform two tasks of : recording and playback.

Thank you,




update 1, If I try to put a message box comment after play and before stop, I am able to render continuous playing, but as soon as I ok the message box, the stream terminates. 

update 2, I tried the same message box strategy for recording, it does record, and the final file size is much larger. but after I "ok" the message box, I get an error message saying "WaveFileWriter was not disposed at WaveFileWriter.Finalize()"  .

update 3, I was able to fix the earlier bug, by adding the line, "writer.Dispose();" to AudioRecorder.Audio project's file AudioRecorder ' s method Stop() at the end before the closing braces ,  that fixes the recording problem and closes the file properly.  So the only problem that I want to know about is : 1. hw to avoid the message box thing   2.  how to avoid a dos pop up from lame ?

Mar 30, 2010 at 9:38 AM

A. I'm sure this is possible but I don't know how. Perhaps ask on stackoverflow

B. Trying to find mixer code that worked on both XP and Vista/7 was next to impossible. I gave up in the end, but if you're willing to experiment a bit with the mixer api's you might find something that works for you. What do you mean by "cribbing"?

C & D. This sounds like you are using window callbacks with a console application. You either must use function callbacks, or have a window somewhere.