0

出于主动降噪的目的,我如何使用 Novocaine 生成反相信号?也就是说,在 a 内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?
        }
    }
}];
4

1 回答 1

-1

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

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

编辑这段代码可能用于反转相位(它甚至可能不起作用)。然而,考虑到 iPhone 本身的延迟,主动降噪通常不仅仅是简单地反转相位。

于 2015-01-13T18:20:35.963 回答