How can I use STFT with Wavelet?

2 次查看(过去 30 天)
Hello everyone, I am applying the example in the link. But additionally I add Wavelet to it. I applied 5 level wavelet. I am trying to implement the block diagram below.
Normally I was writing audio in STFT. But now I have to write c after applying wavelet? How can I use STFT with Wavelet?
len=length(audio);
[c,l]=wavedec(audio,5,'bior3.1');
approx = appcoef(c,l,'bior3.1',5);
[cd1,cd2,cd3,cd4,cd5] = detcoef(c,l,[1 2 3 4 5]);
%% STFT
windowLength = 256;
win = hamming(windowLength,"periodic");
overlap = round(0.75 * windowLength);
ffTLength = windowLength;
fs = 16e3;
numFeatures = ffTLength/2 + 1;
numSegments = 8;
inputFs = 16e3;
cleanSTFT = stft(c,'Window',win,'OverlapLength',overlap,'FFTLength',ffTLength); %normally it was written audio instead of c. But do I have to write c after the wavelet?
cleanSTFT = abs(cleanSTFT(numFeatures-1:end,:));

回答(1 个)

Ayush Modi
Ayush Modi 2024-1-1
Hi,
As per my understanding, you want to calculate the Short-time Fourier Transform (stft) of a discrete wavelet transform of an audio file. You can achieve this by using the detail coefficients of the 5th level wavelet coefficients. Here is an example to demonstrate how you can accomplish this:
cleanSTFT = stft(cd5,'Window',win,'OverlapLength',overlap,'FFTLength',ffTLength);
cleanSTFT2 = abs(cleanSTFT(numFeatures-1:end,:));
I hope this resolves the issue you were facing.

类别

Help CenterFile Exchange 中查找有关 Wavelet Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by