Highlighted

Microphone and playback on iOS

Community Beginner ,
Sep 21, 2016

Copy link to clipboard

Copied

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!

TOPICS
Performance issues

Views

232

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Microphone and playback on iOS

Community Beginner ,
Sep 21, 2016

Copy link to clipboard

Copied

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!

TOPICS
Performance issues

Views

233

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Sep 21, 2016 0
deesharm LATEST
Adobe Employee ,
Sep 22, 2016

Copy link to clipboard

Copied

Hi Elsa,

Thanks for reporting the issue.

We will investigate it further at our end.

Thanks,

Adobe AIR Team

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 22, 2016 0