Forums

Filter to remove noise from a corrupted song

Started by ~farah_r~ November 17, 2007
Hi All,

I need a little help in analyzing this question. I am a student taking
Intro to DSP class and we have this lab in which we're given a corrupted
sound file  from which we have to filter out the noise from it.

So, what I did was I plotted out the FFT of the sound file to figure out
where the interference was, and found that the interference is at freq. of
+ and - 44.04 kHz with magnitude of 2.023*10^5. So, now I gotta filter out
this component using the code snippet below:

[b,a] = zp2tf(z, p, k);
filtered_signal = filter(b, a, corrupt_signal);

The problem I have is in analyzing this thing. How would I know the zeros
and poles for the filter with transfer function [b,a]? I know that the
frequency component at 44.04 kHz is causing the problem, and I know that
the sampling frequency of the signal is 44.1 kHz. So, how would I
determine the poles and zeros of the filter's transfer function so that
that component gets filtered out?

I figure that since the peak of the signal's freq. response is at 44.04
kHz, does that mean the pole of the filter would be at 44.04 kHz? And what
about the zeros of the filter? Am I thinking the right way?

Thanks for the help every1, I know this is a very basic question, but a
li'l hint would be great ;)

Farah.


~farah_r~ wrote:
> Hi All, > > I need a little help in analyzing this question. I am a student taking > Intro to DSP class and we have this lab in which we're given a corrupted > sound file from which we have to filter out the noise from it.
It's bad form to ask the same question twice. You want to keep any answers in the same thread. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
On Nov 18, 12:49 am, "~farah_r~" <farah727r...@gmail.com> wrote:
> Hi All, > > I need a little help in analyzing this question. I am a student taking > Intro to DSP class and we have this lab in which we're given a corrupted > sound file from which we have to filter out the noise from it. > > So, what I did was I plotted out the FFT of the sound file to figure out > where the interference was, and found that the interference is at freq. of > + and - 44.04 kHz with magnitude of 2.023*10^5. So, now I gotta filter out > this component using the code snippet below: > > [b,a] = zp2tf(z, p, k); > filtered_signal = filter(b, a, corrupt_signal); > > The problem I have is in analyzing this thing. How would I know the zeros > and poles for the filter with transfer function [b,a]? I know that the > frequency component at 44.04 kHz is causing the problem, and I know that > the sampling frequency of the signal is 44.1 kHz. So, how would I > determine the poles and zeros of the filter's transfer function so that > that component gets filtered out? > > I figure that since the peak of the signal's freq. response is at 44.04 > kHz, does that mean the pole of the filter would be at 44.04 kHz? And what > about the zeros of the filter? Am I thinking the right way? > > Thanks for the help every1, I know this is a very basic question, but a > li'l hint would be great ;) > > Farah.
Hi Farah, interference at 44kHz is a litle strange - you would not hear it!! Human hearing only goes up to near 20kHz. Besides, you have not told us what the sampling freq of the music is? Hardy
>On Nov 18, 12:49 am, "~farah_r~" <farah727r...@gmail.com> wrote: >> Hi All, >> >> I need a little help in analyzing this question. I am a student taking >> Intro to DSP class and we have this lab in which we're given a
corrupted
>> sound file from which we have to filter out the noise from it. >> >> So, what I did was I plotted out the FFT of the sound file to figure
out
>> where the interference was, and found that the interference is at freq.
of
>> + and - 44.04 kHz with magnitude of 2.023*10^5. So, now I gotta filter
out
>> this component using the code snippet below: >> >> [b,a] = zp2tf(z, p, k); >> filtered_signal = filter(b, a, corrupt_signal); >> >> The problem I have is in analyzing this thing. How would I know the
zeros
>> and poles for the filter with transfer function [b,a]? I know that the >> frequency component at 44.04 kHz is causing the problem, and I know
that
>> the sampling frequency of the signal is 44.1 kHz. So, how would I >> determine the poles and zeros of the filter's transfer function so
that
>> that component gets filtered out? >> >> I figure that since the peak of the signal's freq. response is at
44.04
>> kHz, does that mean the pole of the filter would be at 44.04 kHz? And
what
>> about the zeros of the filter? Am I thinking the right way? >> >> Thanks for the help every1, I know this is a very basic question, but
a
>> li'l hint would be great ;) >> >> Farah. > >Hi Farah, > >interference at 44kHz is a litle strange - you would not hear it!! >Human hearing only goes up to near 20kHz. Besides, you have not told >us what the sampling freq of the music is? > > >Hardy
The sampling freq. of the music is 44.1 kHz... Right, that's why I'm confused...When I plotted the FFT of the corrupted audio, I see only 2 peaks at +44.04k and -44.04 kHz...That would denote that the interference signal has a freq. of 44.04 kHz, am I right? Farah.
~farah_r~ wrote:
>> On Nov 18, 12:49 am, "~farah_r~" <farah727r...@gmail.com> wrote: >>> Hi All, >>> >>> I need a little help in analyzing this question. I am a student taking >>> Intro to DSP class and we have this lab in which we're given a > corrupted >>> sound file from which we have to filter out the noise from it. >>> >>> So, what I did was I plotted out the FFT of the sound file to figure > out >>> where the interference was, and found that the interference is at freq. > of >>> + and - 44.04 kHz with magnitude of 2.023*10^5. So, now I gotta filter > out >>> this component using the code snippet below: >>> >>> [b,a] = zp2tf(z, p, k); >>> filtered_signal = filter(b, a, corrupt_signal); >>> >>> The problem I have is in analyzing this thing. How would I know the > zeros >>> and poles for the filter with transfer function [b,a]? I know that the >>> frequency component at 44.04 kHz is causing the problem, and I know > that >>> the sampling frequency of the signal is 44.1 kHz. So, how would I >>> determine the poles and zeros of the filter's transfer function so > that >>> that component gets filtered out? >>> >>> I figure that since the peak of the signal's freq. response is at > 44.04 >>> kHz, does that mean the pole of the filter would be at 44.04 kHz? And > what >>> about the zeros of the filter? Am I thinking the right way? >>> >>> Thanks for the help every1, I know this is a very basic question, but > a >>> li'l hint would be great ;) >>> >>> Farah. >> Hi Farah, >> >> interference at 44kHz is a litle strange - you would not hear it!! >> Human hearing only goes up to near 20kHz. Besides, you have not told >> us what the sampling freq of the music is? >> >> >> Hardy > > > The sampling freq. of the music is 44.1 kHz... > Right, that's why I'm confused...When I plotted the FFT of the corrupted > audio, I see only 2 peaks at +44.04k and -44.04 kHz...That would denote > that the interference signal has a freq. of 44.04 kHz, am I right?
Something is way wrong. First, 44.04 and 44.10 are close enough together so you'd have to convince me that the difference isn't just measurement error. Second, the highest legitimate frequency in your file is 22.05. Anything more than that is an artifact of the analysis. Jerry -- Engineering is the art of making what you want from things you can get. &#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;
~farah_r~ wrote:
>>On Nov 18, 12:49 am, "~farah_r~" <farah727r...@gmail.com> wrote: >> >>>Hi All, >>> >>>I need a little help in analyzing this question. I am a student taking >>>Intro to DSP class and we have this lab in which we're given a > > corrupted > >>>sound file from which we have to filter out the noise from it. >>> >>>So, what I did was I plotted out the FFT of the sound file to figure > > out > >>>where the interference was, and found that the interference is at freq. > > of > >>>+ and - 44.04 kHz with magnitude of 2.023*10^5. So, now I gotta filter > > out > >>>this component using the code snippet below: >>> >>>[b,a] = zp2tf(z, p, k); >>>filtered_signal = filter(b, a, corrupt_signal); >>> >>>The problem I have is in analyzing this thing. How would I know the > > zeros > >>>and poles for the filter with transfer function [b,a]? I know that the >>>frequency component at 44.04 kHz is causing the problem, and I know > > that > >>>the sampling frequency of the signal is 44.1 kHz. So, how would I >>>determine the poles and zeros of the filter's transfer function so > > that > >>>that component gets filtered out? >>> >>>I figure that since the peak of the signal's freq. response is at > > 44.04 > >>>kHz, does that mean the pole of the filter would be at 44.04 kHz? And > > what > >>>about the zeros of the filter? Am I thinking the right way? >>> >>>Thanks for the help every1, I know this is a very basic question, but > > a > >>>li'l hint would be great ;) >>> >>>Farah. >> >>Hi Farah, >> >>interference at 44kHz is a litle strange - you would not hear it!! >>Human hearing only goes up to near 20kHz. Besides, you have not told >>us what the sampling freq of the music is? >> >> >>Hardy > > > > The sampling freq. of the music is 44.1 kHz... > Right, that's why I'm confused...When I plotted the FFT of the corrupted > audio, I see only 2 peaks at +44.04k and -44.04 kHz...That would denote > that the interference signal has a freq. of 44.04 kHz, am I right? > > Farah.
See Ron N's answer to your original post.
Ok, then I would say that my freq. scale is wrong...but I don't see why cos
I am using the freqz function which gives me a scale of freq.'s from 0 to
44.5k

I could redo the freq. scale which then gives me two peaks at 22.02 and
-22.02 kHz...which I think makes more sense :)

So, I know I could design a notch filter using iirnotch command to filter
out this one freq.

But, I need to know more about the zp2tf function so that I could find out
the transfer function of the filter...

My question is how do I figure out the poles and zeros of the filter's
transfer function? Would a pole at f = 22.02 k and zero at f=0 be
correct?

Thanx,
Farah.

>> The sampling freq. of the music is 44.1 kHz... >> Right, that's why I'm confused...When I plotted the FFT of the
corrupted
>> audio, I see only 2 peaks at +44.04k and -44.04 kHz...That would
denote
>> that the interference signal has a freq. of 44.04 kHz, am I right? > >Something is way wrong. First, 44.04 and 44.10 are close enough together
>so you'd have to convince me that the difference isn't just measurement >error. Second, the highest legitimate frequency in your file is 22.05. >Anything more than that is an artifact of the analysis. > >Jerry >-- >Engineering is the art of making what you want from things you can get. >&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533; >
~farah_r~ wrote:
> Ok, then I would say that my freq. scale is wrong...but I don't see why cos > I am using the freqz function which gives me a scale of freq.'s from 0 to > 44.5k
After a few emails, this: Farah Rasheed wrote: > All right, then just 1 more question for you: I load a file into > matlab which i know is corrupted...The first thing I need to know is > where the interference band is located....to do this, I plot the fft > of the signal and find that it is flat except at 2 peaks...0 and 44.04 > kHz...So, first thing is how do I locate the interference band? Do I > say that the interference signal has a freq of 44.04 kHz...The file is > definitely corrupted, it's not a question of wrong analysis or > anything. > > If you think I am wrong in thinking that the interference signal is at > 44.04 k, then how do I locate the interference band from the corrupted > file loaded into matlab using the [y,fs]=wavread('file_name') code? > > Sorry about troubling you, but you just confused me more...I thought I > had figured out the interference band from the fft, but now you tell > me that it cant be at 44 k...so, I am simply more confused now :( This discussion should be in comp.dsp. That's where I have my technical discussions, not an my private email. What's more, I don't know anything about Matlab, but a lot of people there do. There must be a reasonable way to confine the results to frequencies below F/2, but I don't know what it is. I can tell you how to interpret frequencies that seem to be above that, but it shouldn't be necessary. (If you see a signal at 44.04, you should also see one at 44.1 - 44.04 = .06 = 60 Hz, which might be hum. If you don't see 60 Hz, then something else is wrong. Jerry -- "The rights of the best of men are secured only as the rights of the vilest and most abhorrent are protected." - Chief Justice Charles Evans Hughes, 1927 &#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;