Re: [PSYCHTOOLBOX] Problem with AUDIOREAD

Hi!

Have you tried loading all the sounds first, and then feeding them to audiotrad one by one? 

wavfilename = {'words1.wav', 'words2.wav'}

for x = 1:length(wavefilename)
      wavFile = wavfilename{x}
      [y, freq] = audioread(wavFile)
...
end

Also, check whether you have to feed the entire path to the sound files.

Hope it helps!

Best
N




Sent from Yahoo Mail for iPhone

On Friday, August 4, 2017, 17:28, qwc6pvpeyixqzf6zq3ycc7yzuey27z2jszrnsw2m@... [PSYCHTOOLBOX] <PSYCHTOOLBOX@yahoogroups.com> wrote:

 

I have to run some wav file in random sequence.

I did this sound function:

function playWord();


wavfilename= {'words.wav' };

[y, freq] = audioread(wavfilename);

wavedata = y';

nrchannels = size(wavedata,1);

if nrchannels==1

    wavedata = [wavedata ; wavedata];

    nrchannels = 2;

end

pahandle = PsychPortAudio('Open', [], [], 0, freq, nrchannels);

PsychPortAudio('FillBuffer', pahandle, wavedata);

sounds_onset=PsychPortAudio('Start', pahandle, 1, 0, 1);

PsychPortAudio('Stop', pahandle);

PsychPortAudio('Close', pahandle);


end


it works when wavfilename is made by a single item, but not with a series of simuli.


It always gives me this error:

Error using audioread (line 74)

The filename specified was not found in the MATLAB path.


Error in playWord (line 12)

[y, freq] = audioread(wavfilename);


All stimuli are present in the current folder.


Any helps?