i need some help adding an autoplay function so it randomly plays all 12 of my files,and also need to add a pause in between them while they play, this is the code i have so far.
loopcounter = 0;
repeat = true;
while repeat
sel = input('Enter your selection:','s');
switch round(str2double(sel))
case 1
[y,Fs] = audioread('check_out_whats_new.wav');
sound(y,Fs);
case 2
[y,Fs] = audioread('pacman_death.wav');
sound(y,Fs);
case 3
[y,Fs] = audioread('buy_one_free.wav');
sound(y,Fs);
% etc...
repeat = false;
otherwise
disp('no valid input');
loopcounter = loopcounter - 1;
end
loopcounter = loopcounter + 1;
end
disp('Thank You for Playing!!')
fprintf(['%d loopcouner.\n',sel])
disp(['Total number of files played:', num2str(loopcounter)]);
Aucun commentaire:
Enregistrer un commentaire