How can I use STFT with Wavelet?
조회 수: 3 (최근 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,:));
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1016285/image.jpeg)
댓글 수: 0
답변 (1개)
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.
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!