I'm currently learning to plot in python. Here is a working frequency plotter for a wav file. Now i want to make a filter, which cuts out the frequencies below 300Hz and above 3400Hz, so kinda like a bandpass? Can anyone tell me the easiest way of doing that? I read something about a built in high and lowpassfilter like. Thanks for every answer
"wav_filename.low_pass_filter(3400)", but thats not working.
"wav_filename.low_pass_filter(3400)", but thats not working.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
% matplotlib inline from scipy.io import wavfile from scipy.fftpack import fft, fftfreq import matplotlib.pyplot as plt from pydub import AudioSegment wav_filename = "speech_clean (1).wav" samplerate, data = wavfile.read(wav_filename) total_samples = len (data) limit = int ((total_samples / 2 ) - 1 ) fft_abs = abs (fft(data)) freqs = fftfreq(total_samples, 1 / samplerate) fftfreq? # plot the frequencies plt.plot(freqs[:limit], fft_abs[:limit]) plt.title( "Frequency spectrum of %s" % wav_filename) plt.xlabel( 'frequency in Hz' ) plt.ylabel( 'amplitude' ) plt.show() |