i have code for ploting the spectrogram of a resampled audio but the program showing error .
1 view (last 30 days)
Show older comments
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 Comments
Answers (0)
See Also
Categories
Find more on Multirate Signal Processing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!