How can I divide an audio signal into overlap frames and take FFT to the signal?

Hi,
I need to divide an audio signal into overlap frames of duration = 0.025 sec each, with frame step of 0.01 sec. and multiply each frame by the Hamming window and then take the FFT to the windowed signal......can some one help me please?
[s,Fs] = audioread('my file.wav');
%%%fs = 44100 hz
n=512; %Number of FFT points
Tf=0.025; %Frame duration in seconds
N=Fs*Tf; %Number of samples per frame
Ts=0.01; %Frame step in seconds
FrameStep=Fs*Ts; %Frame step in samples

답변 (4개)

Walter Roberson
Walter Roberson 2015년 7월 23일
편집: Walter Roberson 2015년 7월 23일

댓글 수: 3

Thank you for replay sir,
I tried this
%Read the data to the MATLAB using audioread.
[s,fs] = audioread('C:\Users\Fady\Desktop\NADA MSc\h.wav');
N=length(s) %total num of samples
ts=0.01 %Frame step in seconds
frame_step=floor(ts*fs) %Frame step in samples
frame_duration=0.025 %Frame duration in seconds
frame_length=ceil(frame_duration*fs) %Number of samples per frame
frame_num=ceil(N/frame_step)
y= buffer (N,frame_length,frame_step)
but I get
y=0
0
0
0
0
.
.
.
.
155614
0
0
0
0
.
.
.
I don't know what is the wrong
%note: 155614 is my data length.
for K = 1 : size(s,2)
y{K} = buffer(s(:,K),frame_length,frame_step);
end
This code takes into account the possibility that your audio file has multiple channels.
When yall say frame step, is that referring to the overlap of the frame? i.e. frame duration is the length of a segment, while frame step would refer to where the next segment begins?
If frame duration is 25 ms, and frame step is 10 ms, then the first segment has samples between 0 - 25 ms and the next has samples between 10 - 35 ms and the following has samples between 20 - 45 ms and so on? That's the idea of this code right? Just want to make sure.

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

Reza Safdari
Reza Safdari 2015년 9월 12일
You can use enframe.m function from voicebox, a speech processing toolbox for MATLAB. For more detailed information refer to the following link: http://www.ee.ic.ac.uk/hp/staff/dmb/voicebox/doc/voicebox/enframe.html#_top.
Manolis Michailidis
Manolis Michailidis 2015년 9월 12일
There is a function called spectrogram which does what you want , see the related documentation http://www.mathworks.com/help/signal/ref/spectrogram.html?searchHighlight=spectrogram

댓글 수: 1

Sir
how does the spectrogram function calculate the number of frames into which the signal will be divided given all the arguments like window size, hop length, NFFT points, window type?

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

Pooja Patel
Pooja Patel 2016년 9월 2일
you can split by number of samples or time duration or frame

카테고리

도움말 센터File Exchange에서 Signal Processing Toolbox에 대해 자세히 알아보기

질문:

2015년 7월 22일

댓글:

2020년 11월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by