Playing random audio from pushbutton
Mostrar comentarios más antiguos
I want to play using gui some .wav files randomly from a certain directory without any repeatition. can anyone help me in this regard?
Respuestas (1)
Walter Roberson
el 3 de Dic. de 2015
projectdir = '/Users/Snorky/music';
dirinfo = dir( fullfile(projectdir, '*.wav') );
numfiles = length(dirinfo);
order_to_play = randperm(numfiles);
for K = 1 : numfiles
thisfile = fullfile(projectdir, dirinfo(order_to_play(K)).name );
play this file
end
2 comentarios
hani ab
el 3 de Dic. de 2015
Walter Roberson
el 3 de Dic. de 2015
I solved the random order part for you. You need to figure out how to play the file. There are multiple ways described in the MATLAB documentation.
Categorías
Más información sobre Audio and Video Data en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!