DSPRelated.com
Forums

shifting frequency of an audiofile using matlab

Started by mani...@gmail.com July 5, 2010
Hi all,
As part of a project, I need different sound samples with different frequencies and amplitudes in them but with all samples obtained by doing signal processing on one basic .wav file.
I am trying first to shift a signal with one frequency say 4kHz by a small amount of say 100Hz using Matlab. I multiplied the signal by cos(2*pi*100*t) and took fft. I see two peaks about 4kHz.

q1: How to avoid two peaks?
q2: Will this work for an audio file which has many freq from 0 to 20kHz? (basically this is just freq modulation right?)
q3: Is it possible to change amplitude of just one freq component?
q4: Someone suggested that there is a software called Audacity which can do all these. Can it do what I want?
q5: How can I give an audio file as an input to matlab for processing since matlab deals in digital domain?

I just realised that I need to multiply with exp(j*2*pi*100*t) instead of cosine to avoid the second peak. Is it correct?

Sorry for too many questions and thanks in advance :)
Hey Man,

1) The two peaks are unavoidable unless you want to use a filter to remove the 2nd peak; basic freq modulation

4kz MOD == 4kHz - Mod Freq and 4kHz + Mod Freq
2) Should

3) I would try to increase the Dn coeff for that specific freq; this may work for Fourier Series only; might want to see if what FFT gives you. That's how I would start looking into this problem

4) Maybe :p never used

5)use wavread, or google "how to read in mp3 file into MATLAB"

Cheers !

Hi all,
> As part of a project, I need different sound samples with different frequencies and amplitudes in them but with all samples obtained by doing signal processing on one basic .wav file.
> I am trying first to shift a signal with one frequency say 4kHz by a small amount of say 100Hz using Matlab. I multiplied the signal by cos(2*pi*100*t) and took fft. I see two peaks about 4kHz.
>
>q1: How to avoid two peaks?
>q2: Will this work for an audio file which has many freq from 0 to 20kHz? (basically this is just freq modulation right?)
>q3: Is it possible to change amplitude of just one freq component?
>q4: Someone suggested that there is a software called Audacity which can do all these. Can it do what I want?
>q5: How can I give an audio file as an input to matlab for processing since matlab deals in digital domain?
>
>I just realised that I need to multiply with exp(j*2*pi*100*t) instead of cosine to avoid the second peak. Is it correct?
>
>Sorry for too many questions and thanks in advance :)
hey, thanks a lot man. I actually did it by taking DFT of the samples(got
them by wavread as you suggested :) ) and shifting them, then taking IDFT.
But I face a problem in changing magnitude of a particular frequency. The
DFT samples(Dn) are complex. I want to change the magnitude of one sample.
Should I change only real part so that absolute value will be what I want or
is there some other way?

Thanks a lot.
On Tue, Jul 6, 2010 at 8:43 AM, wrote:

> Hey Man,
>
> 1) The two peaks are unavoidable unless you want to use a filter to remove
> the 2nd peak; basic freq modulation
>
> 4kz MOD == 4kHz - Mod Freq and 4kHz + Mod Freq
>
> 2) Should
>
> 3) I would try to increase the Dn coeff for that specific freq; this may
> work for Fourier Series only; might want to see if what FFT gives you.
> That's how I would start looking into this problem
>
> 4) Maybe :p never used
>
> 5)use wavread, or google "how to read in mp3 file into MATLAB"
>
> Cheers !
> Hi all,
> > As part of a project, I need different sound samples with different
> frequencies and amplitudes in them but with all samples obtained by doing
> signal processing on one basic .wav file.
> > I am trying first to shift a signal with one frequency say 4kHz by a
> small amount of say 100Hz using Matlab. I multiplied the signal by
> cos(2*pi*100*t) and took fft. I see two peaks about 4kHz.
> >
> >q1: How to avoid two peaks?
> >q2: Will this work for an audio file which has many freq from 0 to 20kHz?
> (basically this is just freq modulation right?)
> >q3: Is it possible to change amplitude of just one freq component?
> >q4: Someone suggested that there is a software called Audacity which can
> do all these. Can it do what I want?
> >q5: How can I give an audio file as an input to matlab for processing
> since matlab deals in digital domain?
> >
> >I just realised that I need to multiply with exp(j*2*pi*100*t) instead of
> cosine to avoid the second peak. Is it correct?
> >
> >Sorry for too many questions and thanks in advance :)
> >
> >
>
>

--
Regards,
K.Manikanta Avinash,
EE06B019,
Dual Degree(VLSI),Department of Electrical Engineering,
Indian Institute of Technology,Madras-600036
09962363547