Filter löschen
Filter löschen

data isolation from spectogram

12 Ansichten (letzte 30 Tage)
Micah
Micah am 16 Okt. 2022
Beantwortet: AH am 19 Okt. 2022
I have a spectogram (from an audio file) from which i want to isolate/extract the line with the highest power, most intense color. how can i do this?
the code for the spectogram is as follows.
[A,Freq]=audioread(['bmw s100rr 0-300.mp3']);
NFFT=6000;
spectrogram(A,NFFT,NFFT/2,NFFT,Freq,'yaxis');colormap('jet');
ylim([0 1.8])
the acomponying spectogram can be seen below.
how can I isolate the dark red/black line and gather/isolate its values/plot it in a different graph.

Antworten (1)

AH
AH am 19 Okt. 2022
The function tfridge can be found helpful here. Below is an example showing how to extract the ridge from the spectrogram.
%% Signal model
fs = 3.6e3; % sampling rate in Hz
t0 = 2; % signal duration in seconds
t = (0:1/fs:t0)'; % time samples
x = vco(sawtooth(2*pi*t,0.5),[0.1 0.4]*fs,fs);
%% Spectrogram
NFFT = 256; % number of FFT points
[S,F,T] = spectrogram(x,NFFT,NFFT/2,NFFT,fs,'yaxis');
spectrogram(x,NFFT,NFFT/2,NFFT,fs,'yaxis')
%% Extract ridge (highest power)
[fridge,~,lridge] = tfridge(S,F);
ridge = S(lridge);
%% Figure
figure
spectrogram(x,NFFT,NFFT/2,NFFT,fs,'yaxis')
hold on
plot3(T,fridge/1e3,abs(ridge),'k','LineWidth',2)
For more complicated time-frequency maps, the input penalty in the tfridge should be tuned. Further information can be found in the documentation page (link to Documentation page). Another useful function/GUI is rpmtrack (link) where points on the ridge with the highest power can be inserted manually to further help ridge extraction.
In addition, it would be great if the audio file could be shared.

Produkte


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by