how to apply stft to audio signal?

조회 수: 15 (최근 30일)
studentmatlaber
studentmatlaber 2022년 1월 12일
답변: Bjorn Gustavsson 2022년 1월 12일
Hello everyone. This is my first time processing audio, so I'm a beginner at this. I want to apply stft to my audio signal. It needs to have a 256-point Hamming window length, 128-point overlap, and 256-point transform values. I repeat a study, it says there is a 256-point sample that corresponds to 16ms.
Is this code I wrote correct? I would be glad if you help.
[data,fs]=audioread('SA1.wav')
% data = 46797x1 double
% fs = 16000
d = seconds(16*10e-3);
stft(data,d,'Window',hamming(256),'OverlapLength',128,'FFTLength',256);

답변 (1개)

Bjorn Gustavsson
Bjorn Gustavsson 2022년 1월 12일
You might do this, but the call to seconds looks spooky. From audioread you get the sampling-frequency fs, that is the sampling-frequency you should send in to stft. If that matches the sampling-frequency from the study you're good. If that sampling-frequency doesn't match you will have to work - but making up a sampling-frequency or sampling-time array like you do cannot be anyting but an unnecessary risk, if you're right you might just as well have used fs if you're wrong you only set yourself up for more future pain and toil...
HTH

Community Treasure Hunt

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

Start Hunting!

Translated by