필터 지우기
필터 지우기

Truncating wav files

조회 수: 3 (최근 30일)
Andrew
Andrew 2011년 1월 30일
답변: Satyam Gaba 2017년 11월 19일
I'm new to matlab and just started working with .wav files. I am using the following code to read in and plot a file: [x,fs,k] = wavread('music.wav'); x = x(1:length(x),1); N = length(x); time = [0:1:N - 1]*1/fs; plot(time,x)
I am trying to truncate this down to a 1 second clip. How do I do this? Much thanks for any help!

답변 (2개)

Jan
Jan 2011년 1월 30일
Truncate the wav after 1 sec after the n'th sample:
[x,fs,k] = wavread('music.wav');
y = x(n:n+fs-1, :)

Satyam Gaba
Satyam Gaba 2017년 11월 19일
if true
[x,fs]=audioread('C:\Users\Satyam\Downloads\Music\record20171119115236.wav');
z=zeros(fs*3,40); % for 3 second audio file
h=1;
for j=1:40;
for i=1:(fs*3);
z(i,j)=x(h);
h=h+1;
end
end
end

카테고리

Help CenterFile Exchange에서 Audio and Video Data에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by