data isolation from spectogram
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1158298/image.png)
how can I isolate the dark red/black line and gather/isolate its values/plot it in a different graph.
0 comentarios
Respuestas (1)
AH
el 19 de Oct. de 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.
0 comentarios
Ver también
Categorías
Más información sobre Spectral Measurements en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!