Creating a modified audiofile

1 回表示 (過去 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 Center および File ExchangeAudio 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