出于主动降噪的目的,我如何使用 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?
}
}
}];