Re: How to apply Fourier transform to speech signals?

• To: mathgroup at smc.vnet.net
• Subject: [mg113731] Re: How to apply Fourier transform to speech signals?
• From: hadi motamedi <motamedi24 at gmail.com>
• Date: Tue, 9 Nov 2010 03:54:14 -0500 (EST)

```On 11/8/10, Nasser M. Abbasi <nma at 12000.org> wrote:
>   one way:
>
> --------------------------------
> (*showing how to load wav sound file, listen to it inside Mathematica
> and plot its power spectrum. hacked by Nasser M. Abbasi on Nov 7.2010 at
> the request of hadi motamedi while waiting for coeffe to be ready*)
>
> Remove["Global`*"];
> <<Audio`
>
> SetDirectory[ToFileName[Extract["FileName"/.NotebookInformation[EvaluationNotebook[]],{1},FrontEnd`FileName]]];
>
> ele=Import["example.wav","Elements"]
> Out[169]=
> {AudioChannels,AudioEncoding,Data,SampledSoundList,SampleRate,Sound}
>
> In[170]:= (*listen to it *)
> sound=Import["example.wav","Sound"];
> EmitSound[sound]
>
> In[172]:= Fs=Import["example.wav","SampleRate"]
> Out[172]= 44100
>
> (* now load the samples and do power spectrum *)
> data=Import["example.wav","Data"];
> {nChannel,nSamples}=Dimensions[data]
>
> Out[174]= {2,324864}
>
> Py=Fourier[data[[1,All]]];
> nUniquePts=Ceiling[(nSamples+1)/2];
> Py=Py[[Range[1,nUniquePts]]];
> Py=Abs[Py];
> Py=Py/nSamples;
> Py=Py^2;
> Py=2 Py;
> Py[[1]]=Py[[1]]/2;(*Py=Y*Conjugate[Y];*)
> f=(Range[0,nUniquePts-1] Fs)/nSamples;
>
> ListPlot[Transpose[{f,Py}],
>     Joined->True,
>     PlotRange->All,
>     PlotLabel->"Power Spectrum of wav file",
>     AxesLabel->{"Freq. Hz","power"},
>     ImageSize->400
> ]
>
> -----------------------------------
>
> --Nasser
>
>
Thank you very much for your help. Sorry did you have ever tried for
your code? It seems that it needs some minor modifications to fit real
case but I am not so expert to do that. Can you please help me to get
the final result in real case?

```

• Prev by Date: Re: x and y labels in ArrayPlot
• Next by Date: Re: x and y labels in ArrayPlot
• Previous by thread: Re: How to apply Fourier transform to speech signals?
• Next by thread: Re: How to apply Fourier transform to speech signals?