Creating a noise filter from an .m file

Hi Everyone,
Im a complete newbie at matlab and for a university assignment we have been given an .m file to filter out noise so we can understand a word hidden underneath distortion. The .m file given is incomplete i think and we have to complete the rest. I have added the wavread and wavplay to the .m file but i am stuck now as the file still has the distortion,
Here is the .m file output
function [t, filtered_data] = hitchhikerfilter(t, data)
%Function hitchhikerfilter
%
%A function to help filter out unwanted noise from a signal
%
%Usage: inputs: t (time vector generated from Fs = 11,025Hz
% for a 5 second signal)
% use: t = ((0 : (1 / fs) : 5 - (1 / fs))';
% data (HitchhikerPlusNoise.wav)
% outputs: t
% filtered_data (the original wav file after filtering)
%
data = wavread('hitchhikerPlusNoise.wav');
f = [0 0.1 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0];
m = [1 1 0 0 0 0 0 0 0 0 0 0];
[b, a] = yulewalk(11, f, m);
filtered_data = filter(b, a, data);
filtered_data = filtered_data * 5;
wavplay(filtered_data);
%End of hitchhikerfilter.m
Any help would be really appriciated;)
Kind Regards,
James

5 Comments

Bump for help;(
Bump for help 2,
Surely one of you guys know how this is done??
J
Not a clue. I would note, however, that you have not clearly identified your goals. You cannot expect to remove _all_ noise, so what criteria are you to use to decide if you have successfully completed the assignment?
What it is walter, is i have a wav file and i was given this .m file by my tutor to filter out distortion he has placed over a sentence in a .wav file called hitchhikerPlusNoise.wav. I ran the file through this filter but i dont think its applying properly, or maybe im not applying the time vector to this. when i play the filtered_data at the end its not filtering the distortion out so i can make out his sentence in the .wav file...
Thanks for your reply;)
James

Sign in to comment.

Answers (5)

Chirag Gupta
Chirag Gupta on 22 Apr 2011
I don't have much idea about filter design, but I would assume that you need to play/tweak with the filter to minimize the distortion.

8 Comments

Your assumptions are correct, without the audio file we can do little, I would suggest looking at the documentation for fft, the example provided might help to find information about the noise.
I can send you the files if you want? I have played with the filter but still cannot filter the distortion;(
Put the file or a good sample of it on a free filesharing service, for example https://www.rapidshare.com/
Thanks Paulo, http://www.mediafire.com/?f9656kl3jfa5u51 , this is the exact files as given to me by my instructor, I will gladly donate a few pounds for you to have a drink if you can get this to work, James;)
I have to get the word hidden by the noise, and build a GUI to execute the process;) James
Did you have any luck Paulo?
usually I can filter noise easily with Adobe Audition but this time I couldn't, I'm no audio expert so someone might do better.
thanks for trying Paulo;)

Sign in to comment.

The yulefit() documentation says,
When specifying the frequency response, avoid excessively sharp transitions from passband to stopband. You may need to experiment with the slope of the transition region to get the best filter design.
Your transition is, however, completely sharp -- two steps passed and all remaining steps stopped.
What is the point of using
f = [0 0.1 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0];
instead of
f = [0 0.1 0.1 1.0];
with corresponding
m = [1 1 0 0];
?? The output isn't (I think) made any more precise by using more steps of 0's -- the precision is determined by the order you give, 11.
Perhaps this is intended as a clue.
Have you experimented by taking the fft, zeroing the inner 90% of the frequencies, and ifft'ing back? That would correspond to a perfect band-stop applied to the original sound and would give you a clue as to whether it was a problem with not cutting the frequencies quickly enough. Have you looked at the fft to see where the real energy is? Hint: You may wish to examine this article to determine which frequencies to filter.

5 Comments

Walter if i understood what you are saying i would definitely implement it, i will try with what you have wrote, but im not overly confident, thanks for your reply, James;)
i tried amending the 11 in yulewalk and still having no joy;(
Walter i uploaded the files and the assignment task to http://www.mediafire.com/?f9656kl3jfa5u51 if you want to take a look, i will buy you a drink if you guys can help;) J
its 00:15 in the UK now but i look forward to try some more of your ideas in the morning. Im currently studying a networking degree, but in the first year they have added this to our core subjects, this is why its a bit hard for me to understand some things. Im a cisco CCNP and this is all way over my head... I really appriciate you guys helping, and whoever can get this working i will donate some money so you can have a beer on me;) J
did you have any luck? J

Sign in to comment.

jambo mclean
jambo mclean on 23 Apr 2011
Still hoping for an answer to this total quandery;)

2 Comments

The word part is just too corrupted with noise, I tried with matlab and Adobe Audition, unfortunately without success, the noise isn't limited to a few frequencies, it's all over the spectrum, your teacher might have done it on purpose, try other filter types, maybe you will have more luck than me.
Thanks Paulo;)

Sign in to comment.

jambo mclean
jambo mclean on 23 Apr 2011
hoping for more ideas? anyone?

1 Comment

try asking your teacher for the code he used to add noise to the audio

Sign in to comment.

Asked:

on 22 Apr 2011

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!