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 comentarios

Yazan
Yazan el 30 de Jul. de 2021
Do you need to concatenate a 2-second audio file to have a 2-min file? If yes? Then what's the challenge in that? Just concatenate the data. Am I missing something?
Youssef Darwich
Youssef Darwich el 1 de Ag. de 2021
i have a 2-sec. audio-file of a word speech. I want to make an audio file of a repeating sequence of this speech for 2 minutes. for example: if a have the word speech "MATLAB" on an audio file, i want to create an audio-file which goes for 2 min. by repeating the word "MATLAB". "MATLAB MATLAB MATLAB MATLAB..." for 2 min.
hopfully it is now clear and you can help, :)
Jonas
Jonas el 1 de Ag. de 2021
Editada: Jonas el 1 de Ag. de 2021
have a look into the audioread, audiowrite and repmat function
Youssef Darwich
Youssef Darwich el 6 de Ag. de 2021
thanks, this was helpful

Iniciar sesión para comentar.

 Respuesta aceptada

Yazan
Yazan el 1 de Ag. de 2021

0 votos

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);

Más respuestas (0)

Categorías

Más información sobre Code Generation and Deployment en Centro de ayuda y File Exchange.

Productos

Versión

R2020a

Preguntada:

el 30 de Jul. de 2021

Comentada:

el 6 de Ag. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by