fft on samples of an audio file in matlab

조회 수: 14 (최근 30일)
ir
ir 2013년 4월 24일
댓글: hemalatha 2015년 1월 7일
I'm trying to extract information from a sound file in order to use it in a video classification algorithm I'm working on.
My problem is that I don't know how to work exactly with audio files in matlab.
Below is what I need to accomplish:
-open the audio file and get the sampling rate/frequency.
- I need to work on a window of 2 seconds so I have to loop over the file and get each 2 sec as a window and then do the ftt on each window.
After that it is my turn to use these values to do what I want
any help would be appreciated
Thanks.

채택된 답변

Carlos
Carlos 2013년 4월 24일
If you have a .wav audio named filename you can do
[y, Fs] = wavread(filename)
Where Fs is the sampling frecuency and y your audio samples.
Knowing the sample frecuency you can find the number of samples in 2 seconds (2*Fs).
Before performing the FFT algorithm of 2*Fs points you should apply some kind of windowing.You can find more about windows using doc window.
In order to find more about how to calculate the FFT type doc FFT in your Matlab command window.
  댓글 수: 3
Carlos
Carlos 2013년 4월 24일
It seems you are working with a stereo signal channel. You can sum the stereo signals and divide by two to obtain a mono signal.
Look at these other answers that deal with stereo to mono conversion.
hemalatha
hemalatha 2015년 1월 7일
please explain what is channel..and how the samples are separated in different channels

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

추가 답변 (2개)

ir
ir 2013년 4월 24일
I see, thanks for your help

Theodoros Giannakopoulos
Theodoros Giannakopoulos 2014년 11월 19일
Check out this code from the content of my book.
In general, Matlab does not provide mp3 IO support, so imo the best solution is to use a system command to call ffmpeg to convert the mp3s to wavs, before reading with wavread().
Regarding the window-fft-analysis task, there are many examples in the aforementioned code.

카테고리

Help CenterFile Exchange에서 Audio I/O and Waveform Generation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by