【发布时间】:2021-05-24 16:04:19
【问题描述】:
我一直致力于音频信号的去相关。我正在关注一篇研究论文,其中该技术是以这样一种方式生成一个序列号,即幅度是恒定的,而相位是随机变化的。
现在,问题是我生成了一个正弦波,并对其进行了 fft,使用 NumPy 计算了相位和幅度,如下面的代码所示。
import numpy as np
from scipy.fftpack import fft, rfft, ifft, irfft
Farendsig = ((np.sin(2 * np.pi * np.arange(48000 * 0.02133) * 2000 / 48000)) * 32767).astype(np.int16)
freq = fft(Farendsig, 1024) # fft output complex
phase = np.angle(freq) # phase
magnitude = np.abs(freq) # magnitude
combined = np.multiply(magnitude, np.exp(1j * phase))
FarendSyth = (ifft(combined, 1024) * (32767 + 0j)).astype(np.int16)
现在,当我按照 StackOverflow 的答案重新合成相同的信号时:How to combine the phase of one image and magnitude of the different image into 1 image by using python
。结果信号在某些指标上与原始信号不同。
我在这里做什么错了?
【问题讨论】:
标签: numpy scipy signal-processing fft