Read melodies in portions of 2 seconds Matlab
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Monika Grezer
il 7 Giu 2022
Modificato: Monika Grezer
il 15 Giu 2022
Read melodies in portions of 2 seconds Matlab
0 Commenti
Risposta accettata
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);
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Audio and Video Data in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!