# play sound

**URL:** <https://psychtoolbox.discourse.group/t/play-sound/2056>\
**Category:** Uncategorized\
**Created:** [February 5, 2009, 6:03pm UTC](https://psychtoolbox.discourse.group/t/play-sound/2056 "2009-02-05T18:03:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![aikenphdawn](https://avatars.discourse-cdn.com/v4/letter/a/9fc348/32.png) [@aikenphdawn](https://psychtoolbox.discourse.group/u/aikenphdawn)\
**Post date:** [February 5, 2009, 6:03pm UTC](https://psychtoolbox.discourse.group/t/play-sound/2056/1 "2009-02-05T18:03:38Z")

</div>

play sound

Hi to all,  
I am trying to play a sound. I want to cue the subject when to make a response, and also to let them know when their response has been accepted.&nbsp; So, actually, two different sounds.&nbsp;&nbsp;  
   
I have these two .wav files I picked out that I like (but can&nbsp; be flexible and play another type of file if that works better.)  
   
I found&nbsp; a post from mark.chevillet as well as a reply from Mario, and tried this out:  
   
%% sample code  
   
InitializePsychSound(1);  
freq = 48000; % as per Mario's suggestion!  
nrchannels = 1;  
pahandle1 = PsychPortAudio('Open', [], [], 3, freq, nrchannels);  
filename1 = 'fx000.wav';  
wavedata1 = wavread(filename1);  
PsychPortAudio('FillBuffer', pahandle1, wavedata1,0);  
   
%% end of sample code  
   
but I then get this error:

> \>\> PsychPortAudio('FillBuffer', pahandle1, wavedata1,0);

PTB-ERROR: Audio device 0 has 1 output channels, but provided matrix has non-matching number of 5536 rows.  
Error in function FillBuffer: &nbsp; Usage error  
Number of rows of audio data matrix doesn't match number of output channels of selected audio device.  
   
??? Usage:  
   
underflow = PsychPortAudio('FillBuffer', pahandle, bufferdata [, streamingrefill=0);  
   
I know that I am trying to do something quite simple (I used to just use Snd!) and am probably making this too hard.&nbsp;&nbsp; Can someone set us straight?&nbsp;  
   
Dawn & Amber
