필터 지우기
필터 지우기

what should be the constraint on window length in function melspectrogram?

조회 수: 12 (최근 30일)
hi there
I am using the in built function melspectrogram in a loop, for calculation of spectrograms of a wav dataset.
The code I am using is given below:
fs = 44100;
frameDuration = 0.046;
hopDuration = 0.023;
numBands = 128;
frameLength = round(frameDuration*fs);
hopLength = round(hopDuration*fs);
spec = melSpectrogram(x,fs, ...
'WindowLength',frameLength, ...
'OverlapLength',frameLength - hopLength, ...
'FFTLength',2048, ...
'NumBands',numBands, ...
'FrequencyRange',[50,8000]);
getting the error below:
Error using audio.internal.MelSpectrogramValidator/validateOptionalInputs (line 97)
Invalid window length. WINDOWLENGTH must be in the range [2,size(x,1)], where x is the audio input.
The default window length depends on the specified sample rate: round(fs*0.03).
the audio data length is 160000. Can someone guide me whats wrong here? This is working fine on other dataset, with sampling rate=16000.
Thanks

채택된 답변

jibrahim
jibrahim 2022년 1월 12일
Hi Krishna,
This looks fine. Make sure that your input x is a column vector, not a row vector. The function treats each column as a separate channel, so I would expect to see this error if x is a long row vector,
  댓글 수: 3
jibrahim
jibrahim 2022년 1월 13일
OK... Could you update your reproduction steps to include x? You can either instantiate a vector of the same dimensions, or attach x in a MAT file.
krishna Chauhan
krishna Chauhan 2022년 1월 15일
Yes sir you are right. In first case read(ads) thowring x as 60000X1 double, while in scond the size is 1X6000 double I just checked.Now I can make x as x', but my proble is why read(ads) is reading wav files in different way.
Thanks

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Feature Extraction에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by