ios - 使用 Audio Session 录制时如何减少录音噪音?

标签 ios audio core-audio avaudiorecorder avaudiosession

我的一些录音代码可以正常工作,但录制的音频(来自 iPod touch 内置麦克风)非常嘈杂。

这是我的配置:

    AVAudioSession *audioSession = [AVAudioSession sharedInstance];
    NSError *err = nil;
    [audioSession setCategory:AVAudioSessionCategoryPlayAndRecord error:&err];
    if (err) {
        NSLog(@"audioSession: %@ %d %@", [err domain], [err code], [[err userInfo] description]);
        return;
    }
    [audioSession setActive:YES error:&err];
    err = nil;
    if (err) {
        NSLog(@"audioSession: %@ %d %@", [err domain], [err code], [[err userInfo] description]);
        return;
    }

    recordSetting = [[NSMutableDictionary alloc] init];

    // We can use kAudioFormatAppleIMA4 (4:1 compression) or kAudioFormatLinearPCM for nocompression
    [recordSetting setValue:[NSNumber kAudioFormatLinearPCM] forKey:AVFormatIDKey];

    // We can use 44100, 32000, 24000, 16000 or 12000 depending on sound quality
    [recordSetting setValue:[NSNumber numberWithFloat:44100.0] forKey:AVSampleRateKey];

    // We can use 2 (if using additional h/w) or 1 (iPhone only has one microphone)
    [recordSetting setValue:[NSNumber numberWithInt:1] forKey:AVNumberOfChannelsKey];

    // These settings are used if we are using kAudioFormatLinearPCM format
    [recordSetting setValue:[NSNumber numberWithInt:16] forKey:AVLinearPCMBitDepthKey];
    [recordSetting setValue:[NSNumber numberWithBool:NO] forKey:AVLinearPCMIsBigEndianKey];
    [recordSetting setValue:[NSNumber numberWithBool:NO] forKey:AVLinearPCMIsFloatKey];

我这里的配置是否错误,或者是否有其他方法可以减少录制音频中的噪音?据我所知,有一些录音机应用程序没有噪音。

最佳答案

为此,您必须进行一些数字信号处理。您将必须对麦克风中没有任何声音时听到的噪音进行表征。换句话说,您必须指定正在录制或拾取的白噪声。您可以使用数字声音处理 (DSP) 来完成所有这些表征。然后您可以录制您的音频并减去您之前表征的白噪声。

关于ios - 使用 Audio Session 录制时如何减少录音噪音?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12029260/

相关文章:

c++ - 在波形文件中查找狄拉克

audio - 处理,声音重叠

javascript - 在Web Audio API中录制来自多个AudioBufferSourceNode的音频

ios - 无法在 iphone 上获得正确的频率值

iphone - 使用iPhone SDK剪切音频文件

ios - 当我点击文本字段时,它们没有响应!就好像它们粘在一起了还是什么?

ios - NS_Deprecated 等效于 3rd 方框架

ios - 使用 UISlider 缩放 UIView

ios - warning "Class implementation may not have super class"的含义

ios - 如何正确更新AUSampler的loadInstrument属性?