Bug 14234 - AudioUnit render callback doesn't return audio data from microphone
Summary: AudioUnit render callback doesn't return audio data from microphone
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: 6.4.4
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2013-08-26 07:32 UTC by Mika Aalto
Modified: 2013-08-26 10:23 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

Unit test case for this issue (4.45 KB, application/x-gzip)
2013-08-26 07:32 UTC, Mika Aalto

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and 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 Links.

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.

Related Links:

Description Mika Aalto 2013-08-26 07:32:38 UTC
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
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.
Comment 1 Sebastien Pouliot 2013-08-26 10:23:05 UTC
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
--- a/Users/poupou/Downloads/AudioUnitTest/MicrophoneTests.cs
+++ b/Users/poupou/Downloads/AudioUnitTest2/MicrophoneTests.cs
@@ -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) =>