Skip to main content
ElsaPrieto
Participating Frequently
September 21, 2016
Question

Microphone and playback on iOS

  • September 21, 2016
  • 1 reply
  • 378 views

I've been trying to use the Microphone on iOS, and found that listening the SAMPLE_DATA event messes up with the audio playback.

Here is an example of my code:

var s : Sound = new Sound();

s.addEventListener(Event.COMPLETE, onSoundLoaded);

var req : URLRequest = new URLRequest("theme.mp3");

s.load(req);

private function onSoundLoaded(event : Event) : void {

  var localSound : Sound = event.target as Sound;

  localSound.play();

  var mic : Microphone = Microphone.getMicrophone();m

  mic.addEventListener(SampleDataEvent.SAMPLE_DATA, onSample);

}

private function onSample(event : SampleDataEvent) : void {

  trace('onSample');

}

When I start to listen to the SAMPLE_DATA event, the sound being played starts to crackle, as if it was bad quality.

I've tried to use getEnhancedMicrophone instead, and it's worse, there is absolutely no playback as soon as I start listening to the SAMPLE_DATA event.

I've tried different audio rates, gain, codec, and devices (iPhone, iPad), but nothing seems to improve the situation.

However, if I exit the app and come back to it (without completely relaunching it), I've noticed that it solves the problem when I use getMicrophone. The audio is great and the microphone is recording correctly. If I do that with the enhancedMicrophone, getting back in the app, the audio playback is working again but the microphone is not recording anymore.

I've tried with AIR 22 and AIR 23 with the same results.

Thanks for your help!

This topic has been closed for replies.

1 reply

deesharm
Adobe Employee
Adobe Employee
September 22, 2016

Hi Elsa,

Thanks for reporting the issue.

We will investigate it further at our end.

Thanks,

Adobe AIR Team