# Butterworth filter for signal processing

I have a school project to be able to move a wheelchair according to user instruction. I am currently starting my project by using MATLAB and I have acquire several data for the training purpose. I am stuck at applying the butterworth filter to the signal, here is a sample of my training data $\tt go10.wav$. And here is my code:

[x,Fs] = audioread('go10.wav'); % to read the data
plot(x) ; % plot the data before aprplying the filter
n = 3; % the number of order
beginFreq = 800 / (Fs/2);
endFreq = 2000 / (Fs/2);
[b,a] = butter(n, [beginFreq, endFreq], 'bandpass');
y = filter(b, a, x);
figure;
plot(y) ; % plot the data after applying the filter
p = audioplayer(y,Fs);
play(p) ; % play the record after applying the filter


Here the plotting result,

So my question is,

1. Did I do it right? about the begin and end frequency? and is my n correct?

2. And what can you tell me about this butterworth filter? I know that it's trying to focus on the human voice, but what exactly it does?

First of all when you work with MATLAB I suggest you to use a time axis t.

[x,Fs] = audioread('go10.wav'); % to read the data
t=(0:length(x)-1)/Fs;
plot(t,x) ; % Now when you plot you can see the time in seconds


The code seems to be correct. A butterworth bandpass filter, like others bandpass filter keep only the frequencies in the interval from beginFreq and endFreq. It is impossible to make a perfect filter, so there are a lot of filters like bessel, cebicev, butterworth,... each one have some particular properties and the choice of the better filter depends on the application. In sound processing butterworth filter is quite good. The human voice goes from 100Hz to 1100Hz, if you want to keep the voice in your signal you should change your values to:

beginFreq = 100/ (Fs/2);
endFreq = 1100/ (Fs/2);


A passband filter, like this butterworth, keep only the frequencies in the range you have chosen, so if you have noises in your signal that can't are human voices this filter will remove them. However this filter keeps all noises that have frequency in the vocal range.

• Voice range is generally considered 300Hz to 3000Hz.
– JRE
Nov 19 '15 at 16:49
• I have read that some article say the human voice frequency is from 100Hz - 10kHz. Some said it was between 100Hz - 3000Hz. And you were saying it was in the range of 100Hz - 1100Hz. So, in your opinion, what frequency should I use?
– amaz
Nov 19 '15 at 17:41
• Wikipedia says foundamental range is 85-255Hz en.m.wikipedia.org/wiki/Voice_frequency if you want to keep for example 4 harmonics you can use 85-(255*4) then 85-1020. But 85Hz is too near to 50Hz: the power grid noise frequency. In my opinion is better to start to filter from 100Hz Nov 19 '15 at 18:06