# PsychPortAudio long latencies

**URL:** <https://psychtoolbox.discourse.group/t/psychportaudio-long-latencies/442>\
**Category:** Uncategorized\
**Created:** [March 13, 2012, 2:06pm UTC](https://psychtoolbox.discourse.group/t/psychportaudio-long-latencies/442 "2012-03-13T14:06:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![matadasm](https://avatars.discourse-cdn.com/v4/letter/m/c67d28/32.png) [@matadasm](https://psychtoolbox.discourse.group/u/matadasm)\
**Post date:** [March 13, 2012, 2:06pm UTC](https://psychtoolbox.discourse.group/t/psychportaudio-long-latencies/442/1 "2012-03-13T14:06:29Z")

</div>

I've been trying to use PsychPortAudio a bit, and checking timing (with windows XP). I sent out a TTL pulse via a I/O card and then call PsychPortAudio to play a sound, and send both signals into an oscilloscope to check timing. When I do it with the InitializePsychSound set to needing low latency, the sound itself starts repeating in a weird way and basically crashes matlab. If I don't use the flag to use low latency, I get about a 500 ms latency between the TTL pulse and the sound, which a pretty substantial variance (~50 ms). When I use matlab's built-in sound function, that latency goes down to about 50 ms with less than 10 ms variance.  
  
So, looking at InitializePsychSound, I see that better drivers or a better sound card can fix this. Any particular suggestions on a cheap solution? I really don't need anything that special, latencies on the order of Windows built-in sound function would be OK, although I'd like to do better.  
  
Thanks for any help!

---

<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:** [March 15, 2012, 1:24pm UTC](https://psychtoolbox.discourse.group/t/psychportaudio-long-latencies/442/2 "2012-03-15T13:24:11Z")

</div>

--- In [psychtoolbox@yahoogroups.com](mailto:psychtoolbox@yahoogroups.com), "matadasm" \<matadasm@...\> wrote:  

> \>  
> \> I've been trying to use PsychPortAudio a bit, and checking timing (with windows XP). I sent out a TTL pulse via a I/O card and then call PsychPortAudio to play a sound, and send both signals into an oscilloscope to check timing. When I do it with the InitializePsychSound set to needing low latency, the sound itself starts repeating in a weird way and basically crashes matlab. If I don't use the flag to use low latency, I get about a 500 ms latency between the TTL pulse and the sound, which a pretty substantial variance (~50 ms). When I use matlab's built-in sound function, that latency goes down to about 50 ms with less than 10 ms variance.  
> \>   
> \> So, looking at InitializePsychSound, I see that better drivers or a better sound card can fix this. Any particular suggestions on a cheap solution? I really don't need anything that special, latencies on the order of Windows built-in sound function would be OK, although I'd like to do better.  
> \>

Installing Linux would be one way to (usually) get much better performance out of cheap soundcards or built-in chips -- at least with nowadays very common HDA onboard sound chips.  
  
For Windows, any ASIO card should work pretty well. The Hardware-\>PsychPOrtAudio section of our Wiki has some test results with a few cards. If in doubt, a M-Audio Delta 1010-LT has not ever disappointed us, which is why we pick it in the lab as the default choice whenever we need high timing precision, low-latency, or multi-channel. I don't know its current prize, but probably in the low 100 Euros range. Doesn't mean that dozens of other cards wouldn't work as well.  
  
-mario  
  
  

> \> Thanks for any help!  
> \>
