Manual STFT to obtain spectrogram of an audio signal
9 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
UMAIR RASOOL
am 1 Aug. 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 Kommentare
Siehe auch
Kategorien
Mehr zu Audio Processing Algorithm Design finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!