Creating a modified audiofile

조회 수: 2 (최근 30일)
Youssef Darwich
Youssef Darwich 2021년 7월 30일
댓글: Youssef Darwich 2021년 8월 6일
Hi,
i have a 2 seconds audiofile. How can i create a 2 min. one from the same data. in other words in need to create a loop of the same data in the original 2 sec. file which goes for 2 min.
i appreciate every help, thanks!
  댓글 수: 4
Jonas
Jonas 2021년 8월 1일
편집: Jonas 2021년 8월 1일
have a look into the audioread, audiowrite and repmat function
Youssef Darwich
Youssef Darwich 2021년 8월 6일
thanks, this was helpful

댓글을 달려면 로그인하십시오.

채택된 답변

Yazan
Yazan 2021년 8월 1일
clc, clear
% load data
load handel.mat
filename = 'handel.wav';
audiowrite(filename, y, Fs);
% save only 2 second of audio
y = y(1:2*Fs);
% extend the audio from 2 sec to 2 minutes
rep = round(2*60/2);
yrep = repmat(y, [rep, 1]);
% write the extended audio
audiowrite(filename, yrep, Fs);
% read the extended audio
[y, Fs] = audioread('handel.wav');
% listen to extended audio
sound(y, Fs);
  댓글 수: 1
Youssef Darwich
Youssef Darwich 2021년 8월 4일
this was helpful, thanks a lot!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Audio I/O and Waveform Generation에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by