Repeating Audio Stimulus within the same trial
Hello. I have a touchscreen-based task that presents an image stimulus with an audio stimulus. Participants need to tap on the correct image so that the word is properly matched with the image, then the next trial appears. I wanted to include an option so that the audio stimulus can be played again if the participant wanted to hear it a second time (or third or fourth etc.). I’ve been trying to find a way to figure this out, but it has a been a bit challenging. I basically want participants to have the option to press 'spacebar' in order to repeat the audio stimulus. Is there a way to do that?
I've tried including this in line script but then participants have to press spacebar to move to the next trial (the touch response won't be registered unless space was hit), so that didn't work. There may be a completely different way of doing this, but this is what I've tried..
kb = keyboard() key,time = kb.get_key(keylist = ['space'], timeout = None) if key == 'space': my_sampler = sampler("path" + str(var.stimulus_sound), volume = 1) my_sampler.play()
I have attached a simple experiment file (with image attachments, couldn't upload the recordings, but you could use any audio I suppose).
Any help would be appreciated.