Howdy, Stranger!

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

Supported by

[open] No Sound in Psychopy Backend (Windows, OS 0.26)

edited November 2012 in OpenSesame

Hi,

I'm currently stuck within a strange behaviour of open sesame that I have not encountered before: When creating an experiment with sounds (sampler) no sound is played. When I switch back to the legacy pygame backend everything runs fine. But as I want the increased timing accuracy the pygame backend is no real choice for me.

What am I doing wrong here, is there a certain preference I haven't set?

Cheers,
Johannes

Comments

  • Hi Johannes,

    You're not doing anything wrong! What you're describing is a known problem with OpenSesame 0.26 and should be fixed in 0.27. I would therefore recommend to download the latest pre-release, which should be fairly stable at this point.

    The latest pre-release (currently 0.27-pre21) could be obtained as described here.

    Please let us know if this doesn't solve your problem.

    Best wishes,

    Lotje

    Did you like my answer? Feel free to Buy Me A Coffee :)

  • edited 1:49AM

    Hi Lotje,

    Perfect. That did the trick. I should have asked earlier ;-)

    I installed the 0.27-pre22 Version of OpenSesame and it works like charm.
    No sound problems anymore and even a visual timing problem (that I thought to be due to a different thing) is gone now.

    I have seen now that in the 0.27 Version there is an additional backend expyriment, that will be the default in future.
    Is the timing of expyriment comparable/better/worse than that of psychopy?
    I'm just asking because the experiment we are currently planning (we think we'll start in some weeks) may then be run with the expyriment backend. Or is this still so experimental/beta that you would not recommend its use now?

    Best wishes,

    Johannes

  • Hi Johannes,

    I'm glad to hear the sound problem and even the other problem are solved!

    The idea behind Expyriment back-end is to replace the legacy back-end with a new one that is just as light-weighted and simple, but in addition has timing properties comparable to PsychoPy.

    The Expyriment back-end should be faster and more stable than the PsychoPy back-end. However, since 0.27 is not officially released yet (and therefore not used by that many people yet), you may still encounter some unexpected bugs (although everything appears to be fairly stable).

    If you're happy with the way the PsychoPy back-end works there's probably no reason to change to the new back-end for your current experiment. But since you're asking about this, there may be a reason you would like to switch? In this case you could use the Expyriment back-end.

    For documentation on Expyriment, see:

    And for benchmarks on timing accuracy, see:

    Best wishes,

    Lotje

    Did you like my answer? Feel free to Buy Me A Coffee :)

  • edited November 2012

    Hello again,

    Update: The problem is solved under Windows 7 only.

    In XP we still have the same problem (I tested pre 23 and 24). Even worse, when I try to modify the experiment or create a new one I experience the following errors:

    1) I get the error message that the variable I used for the sound (this may also be valid for pictures, I haven't tested that as sound comes first in the trial sequence I'm testing) in the loop table didn't exist. However, this is not the case. It does exist and is correctly written, etc. When I rename the variable, Opensesame tells me that I shouldn't use "sample" as a variable name. Well, I didn't rename it into "sample". :-/

    2) When I try to set up a new experiment starting from the default template and rename the default sequence "experiment" into something else the whole sequence gets moved to unused items. When I rename it back to "experiment" it moves back again. I can't move in a new sequence instead of the old one, Opensesame tells me that the sequence "experiment" cannot be changed.

    Do you experience these problems, too?

    Thanks for your help,

    Johannes

  • edited November 2012

    Hi Johannes,

    If I understand correctly, you encounter the following problems under Windows XP with 0.27~pre24:

    • The sound playback doesn't work properly with PsychoPy backend (like before)
    • Renaming the main experiment sequence causes it to go to the unused items
    • Renaming a loop variable gives a strange error

    I cannot reproduce these errors, so the problem is likely something specific to your situation. Perhaps it would be best if you post some more detailed information:

    • How exactly are you running the pre-release? Are you using the Windows binaries or do you run from source with your own Python environment?
    • What errors do you get exactly? If an error occurs while running an experiment, in addition to a popup message, there is generally an error (traceback) in the debug window. If an error occurs in the user interface, there is generally an error in the terminal/ windows command prompt, or in a file called opensesame.exe.log. Even if you do not get a popup error message, but something happens that obviously shouldn't, it is likely that there is still error output visible this way.

    Hope this helps!

    Cheers,
    Sebastiaan

  • edited 1:49AM

    I'm not sure if this will be of any help but I had similar issues with sound when using PsychoPy back-end.

    The problem lay in the fact that I was building the experiment (including placing sound items in the trials) using the default back-end (in .26: legacy) and then switching to PsychoPy. This always resulted in the sound not working.

    I discovered that when creating the experiment to switch to PsychoPy back-end BEFORE placing any sound items in the trials would solve the issue.

    I'm currently running an audio-visual experiment using PsychoPy back-end on Opensesame 0.26 without issue.

    Hope this helps.

    Boo.

  • edited November 2012

    Hi,

    I collected some more information on the issue.

    I usually work on a non-admin account under WinXP. Some (though not all) errors seem to be related to this.

    Under a non.admin account: When I start my experiment, it immediately crashes with the following error:


    Runtime error
    Failed to load sample in sampler 'Wort': openexp._sampler.legacy.init()
    the file 'sounds/fff.wav' does not exist

    This happens with both the psychopy and the expyriment backend.

    When working on an admin account the same script runs fine with the expyriment backend. It also does not crash with the psychopy backend but no sound is played.

    The psychopy-run put out the following on the debug console:
    Errors from debug console:


    openexp._canvas.psycho.init_display(): window type = pyglet
    openexp._canvas.psycho.init_display(): waitblanking = True
    openexp._canvas.psycho.init_display(): monitor = testMonitor
    openexp.sampler._legacy.init_sound(): sampling freq = 44100, buffer size = 1024
    openexp.sampler._legacy.init_sound(): mixer already initialized, closing
    experiment.init_log(): using 'C:/Documents and Settings/neuro_l/Desktop/faktsch_experiment/subject-0.csv' as logfile (utf-8)
    experiment.run(): experiment started at Fri Nov 09 18:27:36 2012
    0.8310 WARNING Creating new monitor... 0.8475 ERROR avbin.dll failed to load. Try importing psychopy.visual as the first
    library (before anything that uses scipy) and make sure that avbin is installed. 0.8669 WARNING Use of rgb arguments to stimuli are deprecated. Please use color and colorSpace args instead 0.8671 WARNING User requested fullscreen with size [1024 768], but screen is actually [1280, 1024]. Using actual size 1.6342 WARNING Image 'C:/Documents and Settings/neuro_l/Desktop/faktsch_experiment\pics/pic_020.png' was not a square power-of-two image. Linearly interpolating to be 512x512 6.6084 WARNING Image 'C:/Documents and Settings/neuro_l/Desktop/faktsch_experiment\pics/pic_007.png' was not a square power-of-two image. Linearly interpolating to be 512x512

    In admin as well as in user account with both expyriment and psychopy:

    When clicking on the sampler item, I find myself in script view. When I try to click on 'apply changes and close' or just 'close and forget changes', I get the following error:


    Runtime error
    Recursion detected! Is variable 'sample' defined in terms of itself (e.g., 'var=[var]') in item 'WORD_1' (edit script to fix this)

    When I try to rename the variable (e.g. changing WORD_1 into Wort) I get the following error:


    Runtime error
    Variable 'Ton_Eins' is not set in item 'Wort'.
    You are trying to use a variable that does not exist. Make sure that you have spelled and capitalized the variable name correctly. You may [...]

    Apart from the psychopy related errors there are no further outputs on the debug console.

    Wow, a lot of different errors.

    @booradley
    Thanks. That might be the issue here, too. I created the script with legacy backend first, as my normal desktop computer is a mac and psychopy does not work at all there.

  • edited 1:49AM

    Hi Johannes,

    I don't think it's as bad as it sounds! First of all, the PsychoPy warnings (the ones preceded by a timestamp) that you see in the debug window are harmless.

    That leaves us with two real errors.

    The first error is a bit strange, because it appears that you are referring to a file within a folder (i.e. fff.wav in sounds), is that correct? The OpenSesame file pool does not allow folders and subfolders, so you're probably not using the file pool, right? Do you place the sound files in a subfolder of the experiment folder? If I know how exactly you have organized your files, this will help me track down the problem.

    The second error suggests that there is some variable that is recursively defined. This means that it contains a reference to itself as a value. For example, if you have a variable called my_var and you give it the value [my_var], you will get a recursion error: Trying to evaluate this variable will lead to an infinite loop.

    My guess is that you have specified the sound file as [sample]. Because the sampler also maintains an internal variable that is called sample, this leads to a recursion error. Does that make sense? I appreciate that it's not very intuitive. The work-around would be to define your sound files as [_sample] or something else that is not [sample]. Could this be it? If not, could you perhaps post the sampler script?

    Cheers!
    Sebastiaan

  • edited 1:49AM

    Hello Sebastiaan,

    Regarding the first error:

    Yes, I'm not using the file pool but a folder "sounds" which is a subfolder of the folder containing the .opensesame script file:


    experiment folder
    |_ experiment.opensesame
    |_ sounds folder
    |_ fff.wav and other .wav files
    |_ pictures folder
    |_ .png files

    I tested the experiment today with windows 7 and this error occurs there, too.
    When I select a sampler item, this first error occurs and I'm directly within the script view of the sampler item. I can edit everything inside there and can apply and save it but I cannot get out of the script view.
    When I click "apply and close" the second recursion type error comes up. However, there is no recursion within my variable definitions, I checked this.

    Here is the code of the sampler item:


    define sampler WORD_1
    set volume "1"
    set description "Plays a sound file in .wav or .ogg format"
    set sample "sounds/[sound].wav"
    set pitch "1"
    set duration "1500"
    set stop_after "0"
    set pan "0"
    set fade_in "0"

    The .wav files never have names like "sound" or something similar.

    Cheers,

    Johannes

  • edited 1:49AM

    Hi Johannes,

    I took a closer look and indeed: Regarding the second error, there is a bug in the 0.27 pre-release in the way that variables are evaluated in the GUI for the sampler item (and perhaps other items as well, I'll have to look into this). On the bright side, you can also work with the script view. The script that you posted appears to be fine, regardless of the fact that the sampler GUI claims otherwise and drops you back to the script view. So, if you edit the script and press 'Apply', you should be fine in this respect. (And I'll fix this issue for the next pre-release, so you can use the sampler GUI again.)

    Regarding the first error that you only get under a non-Admin account. Presumably, this is related to the restricted permissions that you have as a non-admin user, but exactly how is mysterious to me. One possibility is that somehow the working directory is not properly changed to the experiment folder. You can find out the working directory by using a simple inline_script like this:

    import os
    print 'Working directory: %s' % os.getcwd()

    Is the working directory set to the experiment directory (it should)? If it is not, does moving the sound and picture folders to the working directory solve your problem?

    Would you mind either uploading your experiment or sending it to me by email (but keep the discussion on the forum, please)? That would help to hunt down these bugs.

    Cheers!
    Sebastiaan

  • edited November 2012

    Hi Sebastiaan,

    Thanks, that code snippet put me on the right track. I had the same problems running XP (admin account!) today. Again OpenSesame complained that the files didn't exist although they did.
    The code snippet revealed that the working directory just remains the directory that contains opensesame.exe.
    So I just changed all the paths in the sampler and the sketchpad items to absolute paths. Now everything runs fine.

    It turns out that the working directory is not changed at all when I open up an experiment that I have not build on the same computer but that I transferred via sftp to that lab PC. However, is this something that you experience as well?

    Cheers! Johannes

  • edited 1:49AM

    Hi Johannes,

    I'm glad you got things running!

    Reading back I noticed that my reply was a bit off, because the working directory should indeed be the OpenSesame folder. So that actually functions as it should. Nevertheless, files in the experiment folder should also be found, because the logic is as follows (see also here):

    • Step 1: First check if the file is in the pool.
    • Step 2: If step 1 fails, check if the file is in the same directory as the experiment. In your case, this is what you want.
    • Step 3: If step 2 fails, simply use the pathname as is. In this last case the working directory becomes important, because relative pathnames (e.g. sounds\my_sound.ogg) are evaluated relative to the working directory. This is probably what happens in your case, but it's not what you want.

    So it seems that the working directory per se is not the problem, but that OpenSesame doesn't know
    the experiment folder. Perhaps you could see what the following script tells you. What should happen (but probably doesn't) is that the working directory is the OpenSesame folder, and the experiment folder is (obviously) the folder that contains the experiment file.

    import os
    print 'Working directory: %s' % os.getcwd()
    print 'Experiment folder: %s' % exp.experiment_path

    Cheers!
    Sebastiaan

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