# a problem with snd.m file

**URL:** <https://psychtoolbox.discourse.group/t/a-problem-with-snd-m-file/1083>\
**Category:** Uncategorized\
**Created:** [January 5, 2009, 6:05am UTC](https://psychtoolbox.discourse.group/t/a-problem-with-snd-m-file/1083 "2009-01-05T06:05:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Allen\_Ingling](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@Allen\_Ingling](https://psychtoolbox.discourse.group/u/Allen_Ingling)\
**Post date:** [January 5, 2009, 6:05am UTC](https://psychtoolbox.discourse.group/t/a-problem-with-snd-m-file/1083/1 "2009-01-05T06:05:32Z")

</div>

Hello,  
I run matlab 2007b on win xp with ptb 3.0.8  
  
the following line (196) in snd.m file:  
  
sound(signal',rate,sampleSize);  
  
 generates the following error:  
  
-------------------------  
??? Error using ==\> playsnd  
Data must have one or two columns.  
  
Error in ==\> sound at 41  
playsnd(y,fs,bits);  
  
Error in ==\> Snd at 196  
 sound(signal',rate,sampleSize);  
-------------------------  
  
the problem is solved when changing the above line to:  
sound(signal,rate,sampleSize);  
  
however, i haven't found a reference to this in the forum or   
anywhere else and have seen others, in the forum, in related   
problems, using this line as it is.  
  
could it be a bug?  
thanks,  
dan

---

<div class="post-metadata">

**Author:** ![mariokleiner](https://avatars.discourse-cdn.com/v4/letter/m/13edae/32.png) [@mariokleiner](https://psychtoolbox.discourse.group/u/mariokleiner)\
**Post date:** [January 14, 2009, 5:00pm UTC](https://psychtoolbox.discourse.group/t/a-problem-with-snd-m-file/1083/2 "2009-01-14T17:00:07Z")

</div>

Snd() expected stereo sound data as row-matrix,  
with each row representing one sound channel.  
You probably passed sound as column matrix,  
so the transpose within Snd causes that error.  
  
I've added an additional error check to future  
releases of Snd.  
  
Btw. If you just need cute little beeps for  
feedback to your subject, the Beeper()  
command may be more convenient.  
  
If you need seriously accurate and flexible  
sound, help PsychPortAudio for our new  
PsychPortAudio sound driver is the better  
choice.  
  
-mario  
  

> --- In [psychtoolbox@yahoogroups.com](mailto:psychtoolbox@yahoogroups.com), "sinbur" \<sinbur@...\> wrote:  
> \>  
> \> Hello,  
> \> I run matlab 2007b on win xp with ptb 3.0.8  
> \>   
> \> the following line (196) in snd.m file:  
> \>   
> \> sound(signal',rate,sampleSize);  
> \>   
> \> generates the following error:  
> \>   
> \> -------------------------  
> \> ??? Error using ==\> playsnd  
> \> Data must have one or two columns.  
> \>   
> \> Error in ==\> sound at 41  
> \> playsnd(y,fs,bits);  
> \>   
> \> Error in ==\> Snd at 196  
> \> sound(signal',rate,sampleSize);  
> \> -------------------------  
> \>   
> \> the problem is solved when changing the above line to:  
> \> sound(signal,rate,sampleSize);  
> \>   
> \> however, i haven't found a reference to this in the forum or   
> \> anywhere else and have seen others, in the forum, in related   
> \> problems, using this line as it is.  
> \>   
> \> could it be a bug?  
> \> thanks,  
> \> dan  
> \>
