I am recording voice on iPhone using AVAudioRecorder and these are my recorder settings:
NSMutableDictionary* recordSetting = [[NSMutableDictionary alloc] init];
[recordSetting setValue :[NSNumber numberWithInt:kAudioFormatAppleIMA4] forKey:AVFormatIDKey];
[recordSetting setValue:[NSNumber numberWithFloat:16000.0] forKey:AVSampleRateKey];
[recordSetting setValue:[NSNumber numberWithInt:1] forKey:AVNumberOfChannelsKey];
The problem is that I can't hear the recorded voice without headphones. I want to be able to hear the voice without headphones also. How should I change my code?
Maybe force-routing the audio output to the speaker will help?
- (void) forceRouteAudioToSpeaker
{
UInt32 audioRouteOverride = kAudioSessionOverrideAudioRoute_Speaker;
AudioSessionSetProperty(kAudioSessionProperty_OverrideAudioRoute,
sizeof(audioRouteOverride), &audioRouteOverride);
}
Don’t forget to include <AudioToolbox/AudioServices.h>
. On second thought, switching the audio category to plain playback should also do the trick, and you say it didn’t…