Howdy, Stranger!

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

Supported by

Problem in the sound of audio files presentation

I have experienced an apparent random problem when I present audio stim using Expyriment. Sometimes, the recorded sound comes along with some white noise. I am using wav files recorded using Audacity. I stress the problem is not related to specific files. For the same file, this problem sometimes happens, sometimes it doesn't. I have alternatively tried to convert the files to mp3 but then I ran into another problem: I get no sound at all even trying many different codecs, such as ffmpeg libmp3lame.

I am using Expyriment 0.7.0 (Revision 7a6b73d) with Python 2.7 in a linux machine using Ubuntu 16.04.

Thank you very much in advance.
Ana Luísa Pinho


  • Hi anapinho,

    Have you checked the audio settings (buffer size, audio devices you are using, and so on)?

  • Dear anapinho,

    as rrr mentioned, this sounds like an issue with a too low audio buffer. Did you change the audio buffer to a custom value? The default is 2048, which should be high enough. You could try increasing it even further with expyriment.control.defaults.audiosystem_buffer_size = 4096 (this needs to be set before initializing Expyriment).

    Could you also check the specifics of the wav file? What is the bitrate of that for instance?

  • Hello,
    Thank you for your suggestions.

    These are the specifications of my wav files:
    RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, stereo 44100 Hz

    I tried to increase the expyriment.control.defaults.audiosystem_buffer_size to 8192 and I still get the same problem. One thing I noticed is that if I open and close twice a file in vlc while running expyriment, the problem is solved. Even though it might be a short-term solution, I still would like to find a more stable long-term solution to this problem.

    Ana Luísa

  • edited February 2017

    Very strange. Could you maybe send me one of the files? Then I can check if it works here.

  • Hello,
    I am not allowed to attach .wav files. Is there any other way I can send it to you?

    Thank you.
    Ana Luísa

  • Depending on the size, you could send it to, or alternatively, send it via services like

  • I just tested with the audio files you sent me and the following script:

    import expyriment as xpy
    exp = xpy.control.initialize()
    s1 = xpy.stimuli.Audio("nord_ou_sud.wav")
    s2 = xpy.stimuli.Audio("ouest_ou_est.wav")
    for x in range(10):

    This worked fine on my computer. I tested with a newer version of Expyriment, though, but that should not make a difference, as there were no changes with regards to audio playback. Does the problem occur with this particular script on your computer? If not, can you send me a script that does show the problem?

    Also, it might be worth to check which Pygame version you are using. I tested with 1.9.3.

  • Hello,
    I am using '1.9.2b8'. Do you think I should upgrade to 1.9.3? I can send my expyriment program if you want, even though it contains many other things. But I am basically loading my Audio, using the same object as you did, i.e. stimuli.Audio().

  • Hello once again,
    How did you install pygame 1.9.3? I installed it through pip and I just did an upgrade and I still get the same (apparently beta version).

  • python -m pip install -U pygame should just work fine. If the installation of Pygame 1.9.3 worked, then you should also get this version when you install it. I don't think two pygame versions can be installed in parallel in the same Python distribution. Are you using different Python installations or virtual environments?

  • Hello,
    I have re-installed pygame to the newest vs, i.e. 1.9.3. I removed the old installation. After several trials (since the problem was apparently random), it seems the problem disappeared. I thus believe it was related to my beta vs of pygame. Thank you very much for your feedback. It helped to solve the problem. :)

  • Great to hear the issue is solved!

Sign In or Register to comment.