How to save samples from audio files?
Afficher commentaires plus anciens
I have the following code for a digital signal processing problem with the file
[x,Fs] = audioread('speech_tait(2).m4a');
sound(x,Fs)
plot(x)
xlabel('Time')
ylabel('Audio Signal')
info = audioinfo('speech_tait(2).m4a');
t = 0:seconds(1/Fs):seconds(info.Duration);
t = t(1:end-2);
L = 1000;
VoicedSpeech = x(L:0+ L-1);
UnvoicedSpeech = x(L:0 + L-1);
%subplot(2,1,1);
% x1 = linspace(0,7);
% y1 = VoicedSpeech;
% plot(x,y1)
%
% subplot(2,1,2);
% y2 = UnvoicedSpeech;
% plot(x,y2)
I need to save 100 samples from the voiced segment (first spike) of the speech into a MATLAB vector called VoicedSpeech and save 300 samples from the unvoiced segment (second spike) of the speech into a MATLAB vector called UnvoicedSpeech, then use the subplot command to plot the two signals, VoicedSpeech and UnvoicedSpeech, on a single figure.
The commented part always gives me an error about having the wrong vector length.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Simulation, Tuning, and Visualization dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!