Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
Created attachment 4712 [details]
Unit test case for this issue
When using AudioUnit instance to record PCM audio from IOS device microphone, all audio bytes returned in callback method are zeros. On IOS simulator audio data is returned as expected.
Attached unit test case to reproduce this issue. Unit test passes on IOS simulator running on Mac but fails when running on IOS device.
Tested with following software and hardware versions:
Xamarin.iOS version 220.127.116.11
iOS Simulator version 6.0 and SDK version 6.1
iPhone 4S device having iOS version 6.1.3
I'm happy to provide any help or additional information which helps you solving this issue.
It seems you're mixing Input and Output incorrectly in your test case. The microphone is an input device, while you're setting stuff for output (playback code?).
The test case works for me with the following change:
diff --git a/Users/poupou/Downloads/AudioUnitTest/MicrophoneTests.cs b/Users/poupou/Downloads/AudioUnitTest2/MicrophoneTests.cs
index 2bd75b6..2dfcb24 100644
@@ -43,7 +43,7 @@ namespace AudioUnitTest
//Configure audio unit to record PCM audio
AudioStreamBasicDescription desc = AudioStreamBasicDescription.CreateLinearPCM (8000, 1, 16, false);
- audioUnit.SetAudioFormat(desc, AudioUnitScopeType.Output, 1);
+ audioUnit.SetAudioFormat(desc, AudioUnitScopeType.Input, 0);
//Set AudioUnit render callback method
status = audioUnit.SetRenderCallback( (actionFlags, timeStamp, busNumber, numberFrames, data) =>