i have code for ploting the spectrogram of a resampled audio but the program showing error .

1 次查看(过去 30 天)
if true
% code
end
this is the code i tried ;
[audio, fs1] = audioread('audio2.wav');
sound(audio,fs1);
ts1=1/fs1;
N1=length(audio);
Tmax1=(N1-1)*ts1;
t1=(0:ts1:Tmax1);
fsu1=fs1/(N1-1);
f1=(-fs1/2:fsu1:fs1/2);
figure;
plot(t1,x),xlabel('Time'),title('Original audio');
fs2 = (20/441)*fs1;
audiore=resample(x,2000,44100);
sound(audiore,fs2);
ts2=1/fs2;
N2=length(audiore);
Tmax2=(N2-1)*ts2;
t2=(0:ts2:Tmax2);
fsu2=fs2/(N2-1);
f2=(-fs2/2:fsu2:fs2/2);
figure;
plot(t2,audiore),xlabel('Time'),title('resampled audio');
function outputSpectrogram(input)
[audioresam, fs] = audioread('audiore');
audioMono = (audioresam(:, 1) + audioresam(:, 2)) / 2;
spectrogram(audioresam, 256, [], 25, 2000, 'yaxis');
title('spectrogram of resampled audio')
end
it showing the error like this "">> resam Error: File: resam.m Line: 1 Column: 1 Function definitions are not permitted in this context.""
how to rectify it??

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Multirate Signal Processing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by