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;
由於下面的代碼..