1
我正在使用AVAudioRecorder类录制用户在我的应用中输入的语音。我可以录制和播放声音。但是,产量的质量很低。尝试播放录制的音频时,背景中出现很多噪音。 我该怎么做才能获得丰富的音质输出。我正在使用以下设置(代码)来录制声音。质量差,同时尝试在iPhone中录制音频
NSMutableDictionary *recordSetting = [[NSMutableDictionary alloc] init];
[recordSetting setValue:[NSNumber numberWithInt:kAudioFormatAppleLossless] forKey:AVFormatIDKey];
[recordSetting setValue:[NSNumber numberWithFloat:44100.0] forKey:AVSampleRateKey]; // previously i'v used 8400
[recordSetting setValue:[NSNumber numberWithInt:1] forKey:AVNumberOfChannelsKey];
和播放音频回
[[AVAudioSession sharedInstance] setCategory:
AVAudioSessionCategoryPlayback error:NULL];
NSURL *fileTobePlayed = [NSURL fileURLWithPath:[[[[UIApplication sharedApplication]delegate] applicationDocumentsDirectory] stringByAppendingPathComponent:[NSString stringWithFormat:@"%@",currentPage]]];
//AVAudioPlayer *audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:recordedTmpFile error:&error];
AVAudioPlayer *audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:fileTobePlayed error:&error];
NSLog(@"The file being played is %@",fileTobePlayed);
[audioPlayer prepareToPlay];
[audioPlayer play];
audioPlayer.volume = 4.0;
由于下面的代码..