使用 FFT 的通道声码器 - 如何处理直流分量和奈奎斯特频率?
我正在尝试使用 iOS Accelerate vDSP FFT 算法实现通道声码器。我无法弄清楚如何处理直流分量和奈奎斯特频率。
调制器和载波信号都是长度为 n 的浮点数组。对于每个,我执行前向 FFT 并返回长度为 n/2 的频率图(称为 bin[])。
根据 vDSP 规范,bin[1] 包含第一个高于 0Hz 的频率,bin[2] 包含第二个频率,等等... bin[0] 包含实部中的直流分量和奈奎斯特频率(通常为bin[n/2]) 位于虚部。 vDSP 本质上将频率图打包到尽可能小的空间中(bin[0] 和 bin[n/2] 的虚部在打包之前应始终为零)。
我将载波和调制器的频率图分成 k 个频段。我的目标是将 Carrier.band[x] 中的每个频率乘以 modulator.band[x] 中频率的总幅度。本质上,增加载波中也存在于调制器中的频率的强度。
因此,如果 n=8 且 k=2,调制器的第二个频带将包含 bin[2] 和 bin[3]。很简单就能找到总大小,只需将每个 bin 的大小相加即可(例如 mag[2] = sqrt( bin[2].real*bin[2]*real + bin[2].imag*bin[2] *图像))。
这对于除第一个频段之外的所有频段都非常有效,因为第一个频段包含带有直流分量和奈奎斯特频率的奇怪 bin[0]。
在计算频带的总幅度时,如何处理第一个 bin?我是否只是假设第一个容器的大小只是直流分量本身?我要放弃奈奎斯特频率吗?
感谢任何可以提供指导的人!我很感激。
I am trying to implement a channel vocoder using the iOS Accelerate vDSP FFT algorithms. I am having trouble figuring out how to treat the DC component and Nyquist frequency.
The modulator and carrier signals are both float arrays of length n. On each, I perform a forward FFT and am returned a frequency plot (call it bin[]) of length n/2.
As per the vDSP specifications, bin[1] contains the first frequency above 0Hz, bin[2] the second, etc... bin[0] contains the DC Component in the real part and the Nyquist frequency (which would normally be in bin[n/2]) in the imaginary part. vDSP essentially packs the frequency plot into as little space as possible (the imaginary part for bin[0] and bin[n/2] should always be zero before the packing).
I split the frequency plot for both carrier and modulator into k bands. My goal is to multiply each frequency in carrier.band[x] by the total magnitude of the frequencies in modulator.band[x]. Essentially, increasing the intensity of those frequencies in the carrier that are also present in the modulator.
So if n=8 and k=2, the second band for the modulator would contain contain bin[2] and bin[3]. Simple enough to find the total magnitude, simply sum the magnitudes of each bin (for example mag[2] = sqrt( bin[2].real*bin[2]*real + bin[2].imag*bin[2]*imag )).
That works great for all bands except the first one, because the first band contains the weird bin[0] with the DC component and Nyquist frequency.
How do I handle that first bin when calculating the total magnitude of a band? Do I just assume the magnitude for the first bin is JUST the DC component by itself? Do I discard the Nyquist frequency?
Thank you to anyone who can provide some guidance! I appreciate it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我建议您忽略 0 Hz 和奈奎斯特,因为它们在音频信号的情况下不包含有用的信息。
I suggest you ignore 0 Hz and Nyquist since they contain no useful information in the case of an audio signal.