Creating a noise filter from an .m file

조회 수: 7 (최근 30일)
jambo mclean
jambo mclean 2011년 4월 22일
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
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일
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월 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일
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일
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일
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일
  댓글 수: 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일
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

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Spectral Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by