def main():
#Select filename
filename = 'scary.wav'
#Test loudest_band with bach, send only one of the two channels
music, frame_rate, nframes, nchannels = read_wave(filename, False)
#Plot FFT of input signal
plot_fft(music[:,0], frame_rate, -5000, 5000)
(low, high, loudest) = loudest_band(music[:,0], frame_rate, 1000)
print("low: ", low, " Hz")
print("high: ", high, " Hz")
#Plot FFT of output signal
plot_fft(loudest, frame_rate, -5000, 5000)
#Write file
loudest = loudest/np.max(loudest) #normalize to amplidue one
loudest = loudest.astype(np.float32) #convert to 32-bit float
wavfile.write(filename[0:-4]+'_filtered.wav', frame_rate, loudest)
评论列表
文章目录