views:

284

answers:

0

Hi

I am using the AVAudioRecorder class to record a wav file. These are the settings that I use for recording

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];

The file is recorded fine, its during playback that the issue is apparent. When I explicitly specify the number of channels as 2, the playback is mono as opposed to stereo when number of channels is not specified (and hence is 1 by default)

Shouldn't the value of AVNumberOfChannelsKey work otherwise - ie stereo playback if the value is 2 and mono playback when no value or 1 is specified?

Is this a bug? If I want to use the AVAudioRecorder class to record audio with number of channels = 2 (I am doing some audio manipulations later and need the number of channels as 2) and give stereo playback, how else should I do it?

Thanks.

Note The other question I had asked here was only to know how to change the mono playback to stereo. But on further investigating the issue, the number of channels in case of the solution is 1 and not 2.