Audio recording and playback using NAudio

When I try recording audio following this here, and using the related source code from here in the ( project), I face the problem that the recording stops within moments of starting and so does the playback. the recorded file is 46 bytes, and playback is there for less than a second, basically, the thread jumps to the next statement immediately. If I try to sleep the thread, it doesn't help. What can I do to keep it in the recording mode or playback mode until user interrupt ?


I've answered on the NAudio forums:

But LBushkin is on the right lines. You need to keep the thread alive while the recording is taking place, and if you are using windowed callbacks, there needs to be a window. Use function callbacks for Console applications.

A short but complete code example may help you get good answers.

In lieu of that, one thing you should make sure that your main thread (assuming this is a console app) does not terminate immediately after starting the audio recording. When the main app thread terminates in .NET, the entire process is terminated - background or worker threads do not keep the process alive.

Need Your Help

R: legend boxes with more than one colour

r plot legend

I have a plot() where multiple colour shadings represent the same thing. I would like to add a legend that conveys this by having dual-coloured boxes (see example below). Is there any way to do this

Error creating bean with name 'sessionFactory'

java spring

hi i am getting the following exception while running my application