Hi,
I have loaded an audio-file of 8sec's using 'wavread' function.
I have to cut it to say 1sec file.
i know that it can be done by taking only few samples outof total samples.
but how can i do it interms of seconds,i.e,i have to get only 1sec audio file from 8sec audio
file
how to do it matlab?
is there any simple inbuilt function.

1 件のコメント

Sivakumaran Chandrasekaran
Sivakumaran Chandrasekaran 2014 年 1 月 22 日
Hope wavwrite could help your question? I am not sure about my answer

サインインしてコメントする。

 採用された回答

Amit
Amit 2014 年 1 月 22 日
編集済み: Amit 2014 年 1 月 22 日

0 投票

You can do something like this: If 1 second removed from end:
[Y,FS,NBITS] = wavread('file.wav'); % Your file name
num_samp = round(FS); % Number of samples in a sec
wavwrite(Y(1:end-numsamp), FS,NBITS,'new_file.wav'); % if 1 second removed from end
IF 1 second removed from beginning
[Y,FS,NBITS] = wavread('file.wav'); % Your file name
num_samp = round(FS); % Number of samples in a sec
wavwrite(Y(numsamp+1:end), FS,NBITS,'new_file.wav');

1 件のコメント

Chandradhar Savanth
Chandradhar Savanth 2014 年 1 月 22 日
Thank you Amit

サインインしてコメントする。

その他の回答 (2 件)

Satyam Gaba
Satyam Gaba 2017 年 11 月 19 日

0 投票

[x,fs]=audioread('C:\Users\Satyam\Downloads\Music\record20171119115236.wav');
z=zeros(fs*1,40); % for 1 second
h=1;
for j=1:40;
for i=1:(fs*1);
z(i,j)=x(h);
h=h+1;
end
end
Veera Kanmani
Veera Kanmani 2018 年 2 月 28 日

0 投票

[x,fs]=audioread('C:\Users\Satyam\Downloads\Music\record20171119115236.wav');
x=resample(1,fs);
audiowrite('newfile.wav',x,fs)

1 件のコメント

Annanya Tyagi
Annanya Tyagi 2019 年 12 月 1 日
resample needs 3 parameters to work

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeAudio Plugin Creation and Hosting についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by