Hello.
I was wondering if there is a way to play a sound for as long a key is pressed, so with the sound starting when the key gets pressed down and stopping when it is released.
There is no problem with repeating the sound as it would be a long beep sound.
The goal is to have the participant listen to a morse sequence with long and short beeps and to have them reproduce it on the space bar, and I wanted to help them by giving sound feedback.
Hey @ajus
Thanks for the input!
However, I now get an error message when trying to start the experiment. I cannot even enter the participant number before it crashes.
That is the exact error message I get:
I did change to ptb in Properties > Audio > Audio Library, and in the code replaced “A” by the path of my sound.
Do you have an idea of what may be happening?
Thanks again for your time.
No, not really, since there is no real error message. Could you try inserting the code into a new and empty experiment just to see if the crash has anything to do with your actual experiment or if it is your machine that maybe can’t handle ptb?
Ok, your file works just fine, yet I am sure my experiment was empty.
I think I’ll be able to figure it out tho, thanks a lot for your time!
edit: ok so apparently, my other sounds were stereo, but mono is needed with ptb. Even when I converted them to mono, it did not work because “force stereo” was checked in the audio settings. I unchecked it and it works now.
Thanks again for your help