a few suggestions and questions
Hi Sebastian,
I have just taken a test drive of OS. It has lots of potential. The GUI programming environment is pretty intuitive, making it is easy for many folks to be up and running quickly. Inline coding provides useful flexibility. Here are some suggestions and questions:
Would it be possible to at a function to read the header of audio files to grab the parameters (sampling rate, channels) to play them back as recorded? Currently it uses what I assume are pygame defaults. I am pretty sure QT4 can take care of this. Values could be set manually using the mixer.
synth_inline_example: Generates an error upon start up complaining about a missing response module. I could not find documentation about one in the inline-code portion of the web site.
Expanding on the above, it would be great if you could include an example, perhaps an expanded version of the above, in which parameters (text, sound file names) are read from an external text file (which is why I looked to the inline example to begin with) and used in the experiment itself. In particular, which tasks should be placed in the "prepare" phase, and can there be more than one "prepare" phase?
I have just taken a test drive of OS. It has lots of potential. The GUI programming environment is pretty intuitive, making it is easy for many folks to be up and running quickly. Inline coding provides useful flexibility. Here are some suggestions and questions:
Would it be possible to at a function to read the header of audio files to grab the parameters (sampling rate, channels) to play them back as recorded? Currently it uses what I assume are pygame defaults. I am pretty sure QT4 can take care of this. Values could be set manually using the mixer.
synth_inline_example: Generates an error upon start up complaining about a missing response module. I could not find documentation about one in the inline-code portion of the web site.
Expanding on the above, it would be great if you could include an example, perhaps an expanded version of the above, in which parameters (text, sound file names) are read from an external text file (which is why I looked to the inline example to begin with) and used in the experiment itself. In particular, which tasks should be placed in the "prepare" phase, and can there be more than one "prepare" phase?
Comments
Hi Mark,
Thank you for your interest in OpenSesame!
It was still using the old system, but it's strange that it didn't work for you. openexp.response should be deprecated, but still functional. At any rate, I fixed it so the example should work now: synth_inline_example.opensesame.
It's probably a good idea to add some more documentation about that. The basic idea is simple: Every item has a prepare phase and the idea is that all the time-consuming stuff is done there. For example, generating a sound would be done in the prepare phase, so that during the run phase you would only have to play it back. And the same with preparing and showing a sketchpad. This way you prevent timing issues during the run phase. There's some info about it in the feedback documentation (link), because it's also an issue there.
But your question is a bit too broad :-) If you ask about a specific task I could tell you, but the general rule of thumb is to put the preparatory stuff in the prepare phase.
Something along those lines could probably be done, yes. Right now it simply opens the mixer at 48Khz, and if samples don't match that they will be played back at an incorrect speed. So, room for improvement there.
That's certainly possible with a bit of inline code, but wouldn't it be more sensible to handle that type of stuff with variables in the loop table? Is there a specific reason why you would want to read variables from an external source?
Kindest regards,
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Perhaps I do not appreciate the power of the loop table. I understand the use of the loop, setting cycles, but only so far as the example code lays them out. Let's say I have a 300-trial exp with a different pair of visual and audio stimuli presented on each trial. I have about six parameters that index each trial on various dimensions. I want all of this information saved with the participant's response on each trial for analysis. Reading from the text file simplifies coding the exp, which amounts to no more than reading and writing variable assignments. I am having difficulty understanding how to integrate this with OS. Thanks.
In the loop you can create a table, where each row corresponds to a trial and each column corresponds to a variable. During every cycle, the loop selects (randomly or sequentially, depending on the order setting) one row from the table and uses this to set the independent variables for that cycle.
Does this make any sense? Have you taken a look at the tutorial? Following the tutorial gives you some hands on experience with loops and loggers: tutorial [PDF].
Check out SigmundAI.eu for our OpenSesame AI assistant!
Thanks, Sebastiaan. I had not realized I could copy a tab-delimited file (table) into those fields. My focus was on understanding how to set up an exp using the code, not the GUI. I generally prefer not to embed such information (i.e., table values) in the program itself, but it does have some advantages.
One last question, pertaining to an item above. To alter the sampling rate, can I just add a call to the mixer in a prepare phase and omit a corresponding run phase, since the latter is not needed? That is, it is not needed because I do would not need to customize anything else.
Keep up the good work, and thank you very much for responding to my queries.
I usually recommend the loop table, particularly to users that are not very experienced programmers. But of course you can also work out your own system with reading a text file and setting variables in a script. In that case you could use numpy.loadtxt() in combination with the OpenSesame functions for setting variables:
You can change the samplerate of the mixer. It's not the epitome of elegance, but this will do the trick (best placed in the prepare phase of an inline_script at the top of the experiment):
import pygame
print "Before:", pygame.mixer.get_init()
pygame.mixer.quit()
pygame.mixer.init(frequency=22050) # Use your preferred samplerate
print "After:", pygame.mixer.get_init()
Hope this helps!
Check out SigmundAI.eu for our OpenSesame AI assistant!