|
[Date Index]
[Thread Index]
[Author Index]
Re: How to apply Fourier transform to speech signals?
- To: mathgroup at smc.vnet.net
- Subject: [mg113696] Re: How to apply Fourier transform to speech signals?
- From: "Nasser M. Abbasi" <nma at 12000.org>
- Date: Mon, 8 Nov 2010 03:38:27 -0500 (EST)
- References: <ib5u1n$c1r$1@smc.vnet.net>
- Reply-to: nma at 12000.org
On 11/7/2010 2:12 AM, hadi motamedi wrote:
> Dear All
> Can you please let me know how can I apply Fourier transform to an
> *.wav speech signal?
> Thank you
>
>
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
Prev by Date:
Re: Numerical simulation
Next by Date:
Re: FFT in mathematica
Previous by thread:
Re: How to apply Fourier transform to speech signals?
Next by thread:
Re: How to apply Fourier transform to speech signals?
|