I want to filter out noises from a voicerecording and normalize it. Currently I am struggeling with a Butterworth bandpass filter.
How do I apply this in my code? (I'm new to Python)
from numpy import nditer
from pydub.audio_segment import AudioSegment
from scikits.audiolab import wavread
from scipy import signal
# Stereo to mono
stereo_sound = AudioSegment.from_wav('voice.wav')
mono_sound = stereo_sound.set_channels(1)
mono_sound.export('voice_mono.wav', format='wav')
podcast = wavread('voice.wav')
for frame in podcast:
print(frame)
print("\n")
print("\n")
# Read mono file
podcast = wavread('voice_mono.wav')
frames = podcast[0]
max_iter = 2000
i = 0
for frame in nditer(frames):
i += 1
if i < max_iter:
print(frame)
# Apply Butterworth filter
# Do Butterworth filter and save as new wav
b, a = signal.butter(4, 100, 'bandpass', analog=True)
Thanks alot!