Logging multiple variables during audio playback
I am designing an experiment where the subject is asked to press the spacebar "in time" with the 20 music stimuli presented in order to measure their pulse synchronicity. So, there are multiple key presses during the stimulus presentation. I can't seem to figure out how to allow for multiple keyboard responses and how to allow for the responses and (most important) their timing to be logged while the audio file is playing.
Things I want to log:
-timing of first spacebar press in relation to the start of the audio stimulus
-timing of each space bar press
-number of space bar presses during the audio stimulus
How might I go about doing this? Thank you,