Skip to content

Instantly share code, notes, and snippets.

@Arunprakash-A
Created October 6, 2018 05:36
Show Gist options
  • Save Arunprakash-A/2031f3394be566cc091ee34350d6422b to your computer and use it in GitHub Desktop.
Save Arunprakash-A/2031f3394be566cc091ee34350d6422b to your computer and use it in GitHub Desktop.
% Matlab 2015 Code Template
clc;
clear all;
close all;
%load noisy speech
[noisy,Fs] = audioread('path to noisy.wav file');
% plot the noisy speech in time domain. xlabel: Time in seconds
% plot the spectra of Noisy speech . xlabel: Frequency in Hz
L = length(noisy);
NFFT = 2^nextpow2(L);
NOISY = fft(noisy, NFFT )/L;
% design the FIR (or IIR) filter based on the observation from the spectral plot.
h_n = fir1(order, cutoff) ;% LP, BP,HP,BS, Multi Band pass, Multi band stop
%plot the magnitude response of the filter
%DO filtering
filtered = filter(h_n,1,noisy);
% plot the spectra of filtered signal
% play the filtered signal, see if there is some reduction of noise contribution
sound(filtered,Fs)
% if it doesnt sound good, change the filter
% if you feel some improvements
audiowrite('name_rollnumber.wav',filtered,FS)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment