Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Delay between parallel port trigger and sound.

Hi everyone,

We are switching our EEG lab's installation to Python. 

We are mainly interested in recording EEG activity during presentation of sounds. However, we have a still unsolved problem concerning the delays between the triggers sent to the recorder and the actual starting time of the sounds : we don't manage to have millisecond accuracy. 

The distribution of delays looks like that :

The jitter is definitely not < 1 ms, it is more around 3 ms. Furthermore, this is a weird looking bimodal distribution ... And it gets even weirder when you look at the delays individually, trial by trial :

We have no explanation for this pattern. Do you have any ideas on why we see this trend across trials ? It kinda looks like an aliasing pattern for me, like if somehow two clocks were running at slightly different speeds and slowly desynchronzying ... 

Here are the details : 

1. We record the delays between the triggers and the sound using a small electrical montage that take (a) the actual sound output as the left channel and (b) the parallel port output pin as the right channel. The two signals are the two channels of a jack cable that is plugged to another computer that records.

2. We are using Expyriment and the xpy.stimuli.Audio.present() method. We have also tried pyAudio with the stream.write(data) method. 

3. We have disable synchronization with the screen (xpy.control.defaults.open_gl=False).

4. We have tried to launch the trigger before and after the xpy.stimuli.Audio.present() method. It doesn't affect the results. 

Thanks a lot for your help !


  • Hi there,

    as described in our paper, as well as in our documentation page, audio accuracy is not ms accurate and can be delayed quite a bit, as you have experienced, depending on a variety of factors. This will be the case with any audio setup to some degree. You can try to decrease the buffer size in order to improve the timing a bit. PyAudio does also help a bit (in fact we will switch our audio system to that in the future). But none of that will get you in the range of 1 ms. Even studio-grade audio setups don't get there.

    The delay, however, might not be so problematic, if you know it and if it doesn't jitter too much. In fact, a jitter of 3 ms is very good (even better than we measured in our tests).

    If this is not sufficient, our common suggestion for ms accurate and stable audio presentation is to use an external device (e.g. a sampler), that is triggered via MIDI.

  • Thanks for your quick reply,

    Yes you are right pyAudio is a bit better and decreasing the buffer size helps a lot. However, when using the same hardware and same computer, but running Presentation (Neurobehavioral Systems), we actually achieve very good timing (latency around 10 ms and jitter around 1ms). Apparently, it may come from the fact that Presentation can take over some background tasks and control the soundcard at a low level. But you are right, if I don't manage to solve the problem, I will definitely rely on an external device and MIDI. Thanks !

  • Yes, 10 ms latency and 1 ms jitter are generally possible on Windows (in my music production PC I have an even lower latency). Especially when using proper ASIO drivers (which are the standard in the pro audio world). I believe that PyAudio can access ASIO devices, so that might be something to look into, but I am not sure how the performance is.

    A second PC/laptop with an ASIO capable audio interface (or even better a Linux system with a JACK server and a real-time kernel) that is triggered from the stimulation PC might also be an alternative to an external device such as a sampler.

  • Ok thanks a lot, I'll try that !

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games