问题
我试图从一组从音频文件中获取的数据中删除一个频率。在
为了简化我的问题,我创建了下面的代码,它创建了一组wave并将它们合并到一个复杂的wave中。然后求出复波的傅里叶变换并求逆。在
我希望看到原始波形的结果,因为应该没有数据丢失,但是我收到了一个非常不同的波形。在
代码:import numpy as np
import matplotlib.pyplot as plt
import random
#Get plots
fig, c1 = plt.subplots()
c2 = c1.twinx()
fs = 100 # sample rate
f_list = [5,10,15,20,100] # the frequency of the signal
x = np.arange(fs) # the points on the x axis for plotting
# compute the value (amplitude) of the sin wave for each sample
wave = []
for f in f_list:
wave.append(list(np.sin(2*np.pi*f * (x/fs))))
#Adds the sine waves together into a single complex wave
wave4 = []
for i in range(len(wave[0])):
data = 0
for ii in range(len(wave)):
data += wave[ii][i]