Problem to use spectrogram on audio file

9 ビュー (過去 30 日間)
Felipe Toledo Muñoz
Felipe Toledo Muñoz 2021 年 1 月 3 日
コメント済み: Rik 2021 年 1 月 4 日
I need to create a 3D graph with the spectrogram in time, frequency and fourier coefficient of an audio ".wav". I managed to plot time and frequency separately but I still can't implement them in the spectrogram.
This is what I have.
clc
close all;
clear all;
[y,fs]=audioread('test.wav');
% Time
t = linspace (0,length(y)/fs,length(y));
figure;
plot(t,y);
title('Time domain')
xlabel('Time')
ylabel('Amplitud')
% Frequency
L=length(y);
Y = fft(y);
P2 = abs(Y/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
f = fs*(0:(L/2))/L;
figure;
plot(f,P1)
title('audio FFT');
xlabel('Frequency (Hz)');
ylabel('Amplitud');
  1 件のコメント
Rik
Rik 2021 年 1 月 4 日
I have restored the edit from Google cache.
Why did you want to remove the code?

サインインしてコメントする。

回答 (1 件)

Star Strider
Star Strider 2021 年 1 月 3 日
You need to actually call the spectrgram or pspectrum functions!
I do not see that you have called either one in your code. Note that you need to have the Signal Processing Toolbox licensed and installed to use these functions.

カテゴリ

Help Center および File ExchangeTime-Frequency Analysis についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by