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 件のコメント

jambo mclean
jambo mclean 2011 年 4 月 22 日
Anyone?
jambo mclean
jambo mclean 2011 年 4 月 22 日
Bump for help;(
jambo mclean
jambo mclean 2011 年 4 月 22 日
Bump for help 2,
Surely one of you guys know how this is done??
J
Walter Roberson
Walter Roberson 2011 年 4 月 22 日
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?
jambo mclean
jambo mclean 2011 年 4 月 22 日
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

サインインしてコメントする。

回答 (5 件)

Chirag Gupta
Chirag Gupta 2011 年 4 月 22 日

0 投票

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 件のコメント

Paulo Silva
Paulo Silva 2011 年 4 月 22 日
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.
jambo mclean
jambo mclean 2011 年 4 月 22 日
I can send you the files if you want? I have played with the filter but still cannot filter the distortion;(
Paulo Silva
Paulo Silva 2011 年 4 月 22 日
Put the file or a good sample of it on a free filesharing service, for example https://www.rapidshare.com/
jambo mclean
jambo mclean 2011 年 4 月 22 日
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;)
jambo mclean
jambo mclean 2011 年 4 月 22 日
I have to get the word hidden by the noise, and build a GUI to execute the process;) James
jambo mclean
jambo mclean 2011 年 4 月 23 日
Did you have any luck Paulo?
Paulo Silva
Paulo Silva 2011 年 4 月 23 日
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.
jambo mclean
jambo mclean 2011 年 4 月 23 日
thanks for trying Paulo;)

サインインしてコメントする。

Walter Roberson
Walter Roberson 2011 年 4 月 22 日

0 投票

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 件のコメント

jambo mclean
jambo mclean 2011 年 4 月 22 日
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;)
jambo mclean
jambo mclean 2011 年 4 月 22 日
i tried amending the 11 in yulewalk and still having no joy;(
jambo mclean
jambo mclean 2011 年 4 月 22 日
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
jambo mclean
jambo mclean 2011 年 4 月 22 日
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
jambo mclean
jambo mclean 2011 年 4 月 23 日
did you have any luck? J

サインインしてコメントする。

jambo mclean
jambo mclean 2011 年 4 月 23 日

0 投票

Still hoping for an answer to this total quandery;)

2 件のコメント

Paulo Silva
Paulo Silva 2011 年 4 月 23 日
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.
jambo mclean
jambo mclean 2011 年 4 月 23 日
Thanks Paulo;)

サインインしてコメントする。

bym
bym 2011 年 4 月 23 日

0 投票

1 件のコメント

jambo mclean
jambo mclean 2011 年 4 月 23 日
No, i could not add my .wav to this code;( Still stuck;(

サインインしてコメントする。

jambo mclean
jambo mclean 2011 年 4 月 23 日

0 投票

hoping for more ideas? anyone?

1 件のコメント

Paulo Silva
Paulo Silva 2011 年 4 月 23 日
try asking your teacher for the code he used to add noise to the audio

サインインしてコメントする。

カテゴリ

質問済み:

2011 年 4 月 22 日

Community Treasure Hunt

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

Start Hunting!

Translated by