play several audio files
    조회 수: 4 (최근 30일)
  
       이전 댓글 표시
    
I have 80 audio files as an experiment stimuli.
I can play 1 audio file but how can I play several files?
% load sound file (make sure that it is in the same folder as this script) 
[soundData freq  ] = audioread('FS1.wav'); 
%inidializes sound driver...the 1 pushes for low latency 
InitializePsychSound(1); 
% opens sound buffer at a different frequency
pahandle = PsychPortAudio('Open', [], [], 2, []); 
% loads data into buffer
PsychPortAudio('FillBuffer', pahandle, soundData'); 
% how many repititions of the sound
repetitions=1; 
%starts sound immediatley
PsychPortAudio('Start', pahandle, repetitions,0); 
댓글 수: 0
채택된 답변
  KALYAN ACHARJYA
      
      
 2019년 8월 26일
        % Code for Audio multiple files read
audio_files=dir('C:\complete_path_to folder\forlder_name\*.wav');
%........................^^........................^^ Note on this
for i=1:length(audio_files)
aud_file=strcat('C:\complete_path_to folder\forlder_name\',audio_files(i).name);
% load sound file (make sure that it is in the same folder as this script) 
[soundData freq]=audioread(aud_file);
%inidializes sound driver...the 1 pushes for low latency 
InitializePsychSound(1); 
% opens sound buffer at a different frequency
pahandle = PsychPortAudio('Open', [], [], 2, []); 
% loads data into buffer
PsychPortAudio('FillBuffer', pahandle, soundData'); 
%pause() if it require??
end
댓글 수: 4
추가 답변 (0개)
참고 항목
카테고리
				Help Center 및 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!

