Howdy, Stranger!

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

Supported by

Noise during sound presentation with sample

If you fill out the information below, we will be able to help you better. 😎 You can also consider asking SigmundAI.eu, our AI assistant with expert knowledge of OpenSesame.

OpenSesame version: 4.0

Operating system: Windows 10

Backend: PsychoPy

Expected behavior

I am running an experiment with two tasks, one is a memory task and one a sound localisation task. During the memory task I present auditory stimuli using inline code. In the sound localization task I use a sampler to present the same sounds. The sounds should be played one at a time and without noise - just what is in the file. Both tasks are shown alternately several times.

Actual behavior (what goes wrong)

All worked perfectly for the first 6 sessions and since than I have not changed anything in the experiment. However, in todays session there was an issue with the sound presentation from the sampler. There was from time to time (sadly quite frequently) some noise in the sound... like a buzz. It almost sounded like the sound was presented twice and overlayed a little. Based on the audiorecording in the MEG data it also looked like the sound was displayed longer than it should have been (the length is identical to the length of the sound file).

Error messages (if any): NA

What did you try already?

Together with the MEG lab manager we tried out different sound systems to see if it was a hardware issue. The noise remained independet of the used hardware. Next we tried to play around with the volume, but that did not work either. Since the issue only arose in the sound localization task and both tasks use the same audiofile it cannot be due to a faulty audiofile, right? Also the very first sounds in the experiment are presented to adjust the volume to the participants liking and they are also presented with the sampler and they are never noisy. So it cannot also not be due to the interaction of the sound files and the sampler, right?

The only thing that worked was rebooting the PC. However, this only worked for the first time running the experiment. The second time the noise was back there. Is there a chance that opensesame fills some buffers that effect the sampler and which are not emptied once opensesame is closed again?

Experiment file (optional)

Consider attaching attaching your .osexp file. If you do not want to share your experiment file, you can also attach a minimal version of the experiment that illustrates the issue.

Comments

  • Hi @Maroes

    Thank you for the detailed report. However, I'm not sure what's causing this without looking at your experiment file directly; I'll ask SigmundAI, our Opensesame AI expert and copy paste its answer below so that you can try its suggestions.

    Let us know how it goes,

    Claire

    -----

    Sigmund: You've done some excellent troubleshooting already! The issue you’re describing—where audio plays with extra noise or sounds "doubled", and the noise persists across hardware but is resolved after a system reboot (but only for one run)—almost always points to audio driver, buffer, or backend issues rather than a problem with your sound files or script logic.

    Here’s a targeted checklist and advice for OpenSesame & PsychoPy backend:

    1. Buffer/Caching Issues

    • Yes, stale audio buffers can cause symptoms like overlays, stutter, or noise.
    • With the PsychoPy backend, OpenSesame’s sampler and Python-based audio code may use different libraries (e.g., sounddevicepygame, or even system devices directly).
    • A known issue: Sometimes, when experiments crash, or audio is played in rapid succession, audio buffers aren’t properly cleared—even if OpenSesame is closed. A full PC restart can clear these, but not always after subsequent runs.

    2. Mixing Different Audio Engines

    • You mentioned using inline code for memory task (likely sounddevice or pygame) and sampler for localization task. Combining multiple libraries (even if all via PsychoPy) can cause conflicts, especially if the underlying hardware is locked by one method and not properly released before use in another.
    • This effect is especially acute with high-precision equipment (like in MEG labs).

    3. “First run after reboot” works, then fails

    • This pattern suggests some software or driver state is being left “unclean” after a run.
    • Could be a bug in the audio backend, especially if long sessions, or multiple audio files are loaded rapidly.

    4. Other considerations

    • If you updated Windows, PsychoPy, or audio drivers recently, note the exact versions/changes. These kinds of bugs can be triggered by OS or driver updates even if your experiment hasn't changed.

    Recommendations

    A. Single Backend Consistency

    • Try using only one method for sound playback (ideally just the Sampler for all tasks, or just inline Python for both).
    • If you must use both, ensure proper shutdown of audio objects** at the end of each task block:
      • If using Python's sounddevice, call sd.stop() or .close() after each sound.
      • Explicitly “unload” or stop Sampler in scripts.
    • If using sounddevice or pygame, avoid mixing with Sampler within a single session.
    • Avoid running two OpenSesame windows/instances simultaneously, which can cause device conflicts.

    B. Tidy Up Between Tasks

    • Insert a very short “silent” sound (e.g., 10 ms) between tasks, or a brief pause (e.g., clock.sleep(100) ms) before and after blocks that use different sound methods. This sometimes resets audio interfaces.
    • Optionally, insert an inline_script between blocks with:
    import sounddevice as sd
    sd.stop()
    Or for pygame (if used):
    import pygame
    pygame.mixer.quit()
    

    C. Update and Test Backends

    • Make sure PsychoPy, OpenSesame, and their plugins are all updated.
    • If the problem persists, try switching the audio backend used by PsychoPy via its preferences (e.g., from sounddevice to pyo, or vice versa).

    D. Audio File Check

    • Double-check the sample rate, bit depth etc. (even if the audio is the same, mismatched properties between your session sounds could expose a bug).
    • Ensure all sounds are the same sample rate and format; mismatched files are known to cause ‘double play/noise’ bugs in Psychopy (see related documentation).

    E. System and Driver Notes

    • If you updated Windows recently, or use a custom soundcard for MEG, check if a driver rollback/test with default drivers helps.
    • If possible, test the same experiment on a different PC (ideally with the same and different hardware).

    Further Steps

    If this checklist doesn't resolve the issue, a minimal example experiment (upload a .osexp to OSF or similar) and system info (OpenSesame/PsychoPy/sound device versions, audio backend used) will help the developers replicate and fix the bug.

    Summary Table

    | Problem | Solution | |--------------------------|---------------------------------------------------------| | Stale Audio Buffers | Stick to one backend, explicitly stop/release audio | | Mixed Sound Engines | Use only Sampler or only inline sound per session | | Sample Rate Mismatches | Convert all files to same sample rate/format | | Unstable Drivers | Test driver rollbacks, use official/updated drivers | | Software Bug | Update OS/psychopy/os, report w/ minimal example |

    Let me know if you want step-by-step instructions for any of the above, or have a small .osexp for review!

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 http://45.77.173.118/ 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