Playing random audio from pushbutton
이전 댓글 표시
I want to play using gui some .wav files randomly from a certain directory without any repeatition. can anyone help me in this regard?
답변 (1개)
Walter Roberson
2015년 12월 3일
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
hani ab
2015년 12월 3일
Walter Roberson
2015년 12월 3일
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.
카테고리
도움말 센터 및 File Exchange에서 Audio and Video Data에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!