How can I use STFT with Wavelet?
2 views (last 30 days)
Show older comments
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,:));
0 Comments
Answers (1)
Ayush Modi
on 1 Jan 2024
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.
0 Comments
See Also
Categories
Find more on Wavelet Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!