Search code examples
iphoneiphone-sdk-3.0avaudiorecorder

iphone - AVAudioRecorder gives mono playback (sound playing in just one channel)


I am using AVAudioRecorder to record audio and save to a wav file (using SDK 3.0) The settings dictionary contains the following values

    NSMutableDictionary *recordSetting = [[NSMutableDictionary alloc] init];

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

    [recordSetting setValue :[NSNumber numberWithInt:16] forKey:AVLinearPCMBitDepthKey];
    [recordSetting setValue :[NSNumber numberWithBool:NO] forKey:AVLinearPCMIsBigEndianKey];
    [recordSetting setValue :[NSNumber numberWithBool:NO] forKey:AVLinearPCMIsFloatKey];

Even after specifying the number of channels as 2, the playback is mono (i.e. playing in only 1 ear jack instead of both the channels).

Has anyone else faced this issue? Is there anything wrong with the recordSetting dictionary values?

Thanks

Can anyone please help me with this... If I specify the number of channels as 2, why would the playback be in just one jack? (I am using headphones for testing - the ones which came with my iPhone)


Solution

  • No, nothing is wrong in your settings. If you try your app on the simulator it will record and play on two channels. However, iPhone 3G and 3GS only record audio using one channel. This apply also to the audio of movies shot on 3GS.

    Therefore, it is not a bug.