Python Forum
Frequency Filter for wav file plotting in python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Frequency Filter for wav file plotting in python
#1
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.
%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()
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to denoise ECG Signal with median filter using WFDB for Python? fhp0223 0 2,190 Aug-05-2020, 07:10 AM
Last Post: fhp0223
  Filter data based on a value from another dataframe column and create a file using lo pawanmtm 1 4,282 Jul-15-2020, 06:20 PM
Last Post: pawanmtm
  How to filter specific rows from large data file Ariane 7 8,198 Jun-29-2018, 02:43 PM
Last Post: gontajones

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020