Read melodies in portions of 2 seconds Matlab

2 visualizzazioni (ultimi 30 giorni)
Read melodies in portions of 2 seconds Matlab

Risposta accettata

VINAYAK LUHA
VINAYAK LUHA il 8 Giu 2022
Modificato: VINAYAK LUHA il 8 Giu 2022
Hi Monika,
Hope this sorts your problem.
[y,fs] = audioread('filename.mp3');
info =audioinfo('filename.mp3');
sample_every=2;
dur=round(info.Duration);
trimmed=[[]]
for i=0:2*sample_every:dur
if(i==0)
trimmed =[trimmed;y(1:min(dur*fs,sample_every*fs),:)];
else
trimmed =[trimmed;y(i*fs:min(dur*fs,(i+sample_every)*fs),:)];
end
end
sound(trimmed,fs);
audiowrite("trimmed.wav",trimmed,fs);

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by