如何在录制音频会话时消除背景噪音?

时间:2016-12-30 07:06:23

标签: ios objective-c avaudiorecorder avaudiosession

我正在使用AVAudioRecorder录制人声,之后需要改变音高以应用一些效果。为此我使用AVAudioPlayerNode.But它还记录了背景噪音。我搜索了很多,但我找不到完美的solutions.below是我记录音频的代码。我找到了一些我们需要为此做DSP(数字签名处理)的地方。



recordSetting = [[NSMutableDictionary alloc] init];
    [recordSetting setValue :[NSNumber numberWithInt:kAudioFormatLinearPCM] forKey:AVFormatIDKey];
    [recordSetting setValue:[NSNumber numberWithFloat:44100.0] forKey:AVSampleRateKey];
    [recordSetting setValue:[NSNumber numberWithInt: 1] forKey:AVNumberOfChannelsKey];
    [recordSetting setValue:[NSNumber numberWithInt:16] forKey:AVLinearPCMBitDepthKey];
    [recordSetting setValue:[NSNumber numberWithBool:NO] forKey:AVLinearPCMIsBigEndianKey];
    [recordSetting setValue:[NSNumber numberWithBool:NO] forKey:AVLinearPCMIsFloatKey];
    [recordSetting setValue:[NSNumber numberWithInt: AVAudioQualityHigh]forKey:AVEncoderAudioQualityKey];
    
    NSArray* documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString* fullFilePath = [[documentPaths objectAtIndex:0] stringByAppendingPathComponent: @"in.caf"];
    inUrl = [NSURL fileURLWithPath:fullFilePath];
    voiceRecorder = [[ AVAudioRecorder alloc] initWithURL: inUrl settings:recordSetting error:&error];
    //[audioRecorder setMeteringEnabled:YES];
    [voiceRecorder setDelegate: self];
    [voiceRecorder prepareToRecord];




有人可以帮助我消除背景噪音,以便我可以清晰录音。

0 个答案:

没有答案