How to save samples from audio files?
이전 댓글 표시
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.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Audio I/O and Waveform Generation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!