Recording with AudioQueue and Monotouch static sound demonstrates how to get audio via an iPhone's microphone into an AudioQueue using Xamarin.iOS. My question is: how do I keep the microphone continuously recording? I basically want to keep the microphone on for as long as the app is open, and continuously capture the audio stream (note that I do not want to save the stream to file). Inside a long-running while-loop?
Asked
Active
Viewed 5,057 times
1 Answers
2
This should work: https://github.com/sami1971/SimplyMobile/blob/master/iOS/SimplyMobile.Media/Audio/AudioStream.cs
Initialize and use Start() on application start and then call Stop() when application closes (or goes background). Captured buffers are delivered through event handler OnBroadcast.
EDIT: Here is a quick WaveRecorder class. I have not had time to test it so if you find bugs in it, please push back changes or let me know what needs to be changed. https://github.com/sami1971/SimplyMobile/blob/master/Core/SimplyMobile.Media/Audio/WaveRecorder.cs

SKall
- 5,234
- 1
- 16
- 25
-
Thanks, that works perfectly! But now I am struggling to play the stream produced - trying to use the example from Xamarin [Streaming Audio](http://docs.xamarin.com/samples/StreamingAudio/). Am able to successfully stream an MP3, but not the audio from the microphone. – mrtnkrstn Jan 13 '14 at 13:15
-
If you are saving the output to a file then you need to add WAV headers to it first, otherwise it is pure PCM. Writing a wave output isn't very difficult, I might add one to my library if I can find time tonight. – SKall Jan 13 '14 at 23:43
-
Nope, not recording first, so it is pure PCM. Thanks for your help! – mrtnkrstn Jan 15 '14 at 10:20