iPhone – AVAudioRecorder mono playback problem

Before initializing the AVAudioRecorder, we need to configure the record setting such as the sampling rate and the audio format.

Most of the AVAudioRecorder examples in web have similar record setting as follow:

[recordSetting setValue :[NSNumber numberWithInt:kAudioFormatAppleIMA4] forKey:AVFormatIDKey];
[recordSetting setValue:[NSNumber numberWithFloat:44100.0] forKey:AVSampleRateKey]; 
[recordSetting setValue:[NSNumber numberWithInt: 2] forKey:AVNumberOfChannelsKey];

 

Althouhg the number of channels is set to 2, the playback is mono which means the audio playback only output in one speaker.

After searching a while in Google, the problem is solve by commenting the channel setting.

[recordSetting setValue :[NSNumber numberWithInt:kAudioFormatAppleIMA4] forKey:AVFormatIDKey];
[recordSetting setValue:[NSNumber numberWithFloat:44100.0] forKey:AVSampleRateKey]; 
//[recordSetting setValue:[NSNumber numberWithInt: 2] forKey:AVNumberOfChannelsKey];

 

Then you should get the stereo instead of mono playback.

Done =)

Reference: StackOverflow – iphone – AVAudioRecorder gives mono playback

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.