使用Novocaine主动降噪

时间:2014-09-27 03:20:55

标签: ios macos core-audio novocaine

对于有源噪声消除目的,如何使用Novocaine产生反相信号?也就是说,在NovocaineOutputBlock内,如何生成与输入相差180度的输出?

到目前为止,这是我的代码:

__weak AppDelegate * wself = self;

self.ringBuffer = new RingBuffer(32768, 2);
self.audioManager = [Novocaine audioManager];

[self.audioManager setInputBlock:^(float *data, UInt32 numFrames, UInt32 numChannels)
{
    wself.ringBuffer->AddNewInterleavedFloatData(data, numFrames, numChannels);
}];

[self.audioManager setOutputBlock:^(float *data, UInt32 numFrames, UInt32 numChannels)
{
    wself.ringBuffer->FetchInterleavedData(data, numFrames, numChannels);

    for (int i=0; i < numFrames; ++i)
    {
        for (int iChannel = 0; iChannel < numChannels; ++iChannel)
        {
            // Within here do noise cancellation. How?
        }
    }
}];

1 个答案:

答案 0 :(得分:-1)

我一直想知道同样的事情。我的想法是使用这样的东西:

data[i*numChannels + iChannel] *= -1;

EDIT 这段代码可能用于反转阶段(甚至可能无法工作)。然而,考虑到iPhone本身的延迟,通常有更多的有源噪声消除而不是简单地反相。

相关问题