Manual STFT to obtain spectrogram of an audio signal
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi, Im trying to obtain the notes that are on an audio signal by using the spectrogram to know the frequencies on it, but i dont know why this code plots me an empty graph. Can sombody help me please.
[x,fs]= audioread("estrellita.mp3");
dt = 1/44100;
t=0:dt:(117204*dt)-dt;
S = zeros(501,117);
windowlength = 1e3;
k = 1;
for jj = 1:117
y = x(k:k+windowlength-1)';
ydft = fft(y).*gausswin(1e3);
S(:,jj) = ydft(1:501);
k = k+windowlength;
end
F = 0:44100/1000:44100/2;
T = 0:(1e3*dt):(117000*dt)-(1e3*dt);
surf(T,F,20*log10(abs(S)),'EdgeColor','none')
axis xy; axis tight; colormap(jet); view(0,90);
xlabel('Time');
ylabel('Frequency (Hz)');
set(gca,'YDir','Normal')
xlabel('Time (secs)')
ylabel('Freq (Hz)')
title('Short-time Fourier Transform spectrum')
0 comentarios
Respuestas (1)
UMAIR RASOOL
el 1 de Ag. de 2020
close all
clear all
clc
[y,Fs]=audioread('black_hole.mp3');
Y=fft(y,Fs);
L= (1:length(Y))*Fs/length(Y);
plot(L,abs(Y))
xlabel('Frequency');
ylabel('Amplitude');
title('(Magnitude Spectrum')
windowSize = 256;
windowOverlap = [];
freqRange = 0:Fs;
spectrogram(y(:,1), windowSize, windowOverlap, freqRange, Fs, 'xaxis');
0 comentarios
Ver también
Categorías
Más información sobre Time-Frequency Analysis 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!