2 CallBack functions ? - SOLVED
Dear Expyriment experts,
I want to create a design where people have to follow a rhythm (at a specific frequency) using a keyboard. What would be the best approach to code this? I need to log the key (rt) and the rt tones as well.
So far I don't know how I can use two callback functions to get info from keyboard and keep playing the tone. It seems that I cant use keyboard.wait() and using keyboard.check() doesn't give me rt.
Thank you in advance for your help
Arnaud

Comments
Oops I think I already have my answer. Everything is already logged even using keyboard.check.
Hi there,
can you give a code example?
In general, though, if you need very stable and precise audio timing, I would suggest to have the audio played by a dedicated hardware audio sampler, triggered via MIDI from the PC that records the responses.
So far I was just testing some basic code, but I notice that it may miss a tone sometime. What would be your suggestion ? Thank you in advance.
To be honest, I do not understand what you are aiming to do in that code. The
my_callbackfunction does not do anything it seems (well, it checks for the keys, but it does nothing with the results of that check).If I do understand correctly what you are trying to achieve, then here are two ways to achieve this:
1)
2)
I want to stress again, though, that if you need perfect timing, an external device is the way to go.
I know that nothing has been written as a data file but everything is logged in the events folder and it's what I was looking for. Thank you for your advice.
I don't think I need perfect timing but what would be the worst case scenario if I keep this kind of script ?
The worst case scenario is that you have a jitter of unknown size, leading to (a) you not knowing when exactly the sound was actually played via the speakers, and (b) an unstable rhythm, when playing back sounds consecutively like you do.