Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def noise_reduction_ourrec(dirName):
- types = ('*.wav', '*.aif', '*.aiff', '*.mp3', '*.au', '*.ogg')
- wav_file_list = []
- for files in types:
- wav_file_list.extend(glob.glob(os.path.join(dirName, files)))
- wav_file_list = sorted(wav_file_list)
- wav_file_list2 = []
- print(os.getcwd())
- for i, wavFile in enumerate(wav_file_list):
- j=1
- Frequency,samples =read(wavFile)
- FourierTransformation = sp.fft(samples) # Calculating the fourier transformation of the signal
- scale = sp.linspace(0, Frequency, len(samples))
- b,a = signal.butter(5, 9800/(Frequency/2), btype='highpass') # ButterWorth filter 4350
- filteredSignal = signal.lfilter(b,a,samples)
- c,d = signal.butter(5, 200/(Frequency/4), btype='lowpass') # ButterWorth low-filter
- newFilteredSignal = signal.lfilter(c,d,filteredSignal) # Applying the filter to the signal
- name = "Wavfile"+str(i)
- j=j+1
- print(name)
- librosa.output.write_wav(name, newFilteredSignal,Frequency)
Add Comment
Please, Sign In to add comment