Play sound from a list based on key response until participant chooses to move on
I want to create a loop in which participants can choose to press "1" or "2" to trigger a sound to be played at random from a corresponding sound list. For instance, there may be the following lists of sounds:
List1: 1a.wav, 1b.wav, 1c.wav
List2: 2a.wav, 2b.wav, 2c.wav
Within a loop, participants would see a Sketchpad that says "Press 1 or 2 to hear a sound from the corresponding list." They could then repeatedly press "1", for instance, to hear sounds from that list (one per click, at random), or they could alternate between pressing "1" and "2" to hear sounds from either list.
Once they are satisfied, I want there to be a third option for participants to press, like "0", to move on to the next portion of the experiment.
I believe this will involve a keyboard_response within a loop with allowed responses "1; 2; 0" (for instance), and nested items (of some sort?) which are run conditionally in the sequence depending on which key response is given ("1" or "2", and with "0" triggering the whole loop to end).
Any advice on how I might go about this complex process?
Comments
Hi @JKellogg,
There are probably several ways to do this., but here's one method that is realtively economical.
Here's the logic:
1. Set Up the Experiment
1.ogg,2.ogg) to the File Pool.2. Task Workflow
Step 2.1: Initialize Variables
1and2).Step 2.2: Main Loop
0) is pressed.Step 2.3: Participant Instructions
Step 2.5: Select a Sound
Add an
to:
Step 2.6: Play the Sound
A couple of additional comments:
Here's my version. You should be able to adapt it to meet your needs:
Hope this helps,
Fabrice.
I was able to get this to work perfectly, thank you!