Implementation of Tapping Task


Author
Message
hannahstr
hannahstr
Partner Member (519 reputation)Partner Member (519 reputation)Partner Member (519 reputation)Partner Member (519 reputation)Partner Member (519 reputation)Partner Member (519 reputation)Partner Member (519 reputation)Partner Member (519 reputation)Partner Member (519 reputation)
Group: Forum Members
Posts: 2, Visits: 10
Hi,

We are working on a music task where participants have to assess musical excerpts regarding tempo and rhythm (passive condition) and to reproduce the same stimuli (active condition). Now we somehow struggle to implement the latter.

Ideally, the active condition should look like this: A music excerpt (mp3) is played, followed by a short pause, and then the participant has to reproduce the rhythm heard by tapping on the space bar. We'd like to assess the time intervals between each tap made by the participant. At best, it would also be great to have the absolute time intervals between the participant's tap and the onset of each beat of the actual stimulus computed, but I am not sure in how far this can be implemented.

Thanks a lot for your advice!

Hannah



Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
I'm not sure what exactly the question is. What are you having trouble implementing specifically?

EDIT: To streamline this, perhaps you can provide a concrete, stripped down example consisting of, say:
- 2 or 3 example sounds / rhythms that participants are supposed to hear and reproduce.
- The *nominal* intervals for the above example sounds, i.e., what the actual intervals between the (to-be-reproduced) beats are.
- A clear description and example of how you conceive "the absolute time intervals between the participant's tap and the onset of each beat of the actual stimulus computed". Lets say there are 4 "actual" beats starting at 0 (1st beat), 500ms later (2nd beat), 3rd beat 600ms after the 2nd beat, and the 4th and final beat 500ms after the 3rd. I.e, you have three "actual" intervals:

500 (between 1st & 2nd beat),
600 (between 2nd & 3rd beat), and
500 (between 3rd & 4th beat).

Suppose the participant produces the following intervals:

567,
499, and
523.

What exactly should be calculated? A simple difference per interval "reproduced - nominal" (567 - 500 = 67; 499 - 600 = -101, etc.)? Some sort of cumulative value across all three intervals? A squared difference in order to penalize larger deviations? Something else entirely?

Edited 8 Years Ago by Dave
hannahstr
hannahstr
Partner Member (519 reputation)Partner Member (519 reputation)Partner Member (519 reputation)Partner Member (519 reputation)Partner Member (519 reputation)Partner Member (519 reputation)Partner Member (519 reputation)Partner Member (519 reputation)Partner Member (519 reputation)
Group: Forum Members
Posts: 2, Visits: 10
Hi Dave,

Thanks a lot for your reply!

If the "reproduced - nominal" difference could be computed, this would be perfect. By now, there is no need of any further assessment.

To provide you with an actual example, these are the inter-onset-intervalls of two sample rhythms in milliseconds:

1. 520 260 520 260 520 260 260
2. 520 130 260 260 130 260 260 130 130 260 520

I hope this claifies my question.

Best,
Hannah

Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
Since I do not have any suitable audio files, I can only provide an example / illustration with <text> stimuli (just imagine the rhythm playing during the "listen" trial). The general logic you need to implement, however, is the same and it goes something like this:

<values>
/ nbeats = 0
/ tapcount = 0
/ t_previoustap = 0
/ t_currenttap = 0
/ tapinterval = 0
/ current_nominal = 0
/ current_reproduced = 0
/ current_difference = 0
/ all_nominal = ""
/ all_reproduced = ""
/ all_differences = ""
</values>

<block myblock>
/ trials = [1-2=listen]
</block>

<trial listen>
/ ontrialbegin = [values.nbeats = 0; values.tapcount = 0;
    values.t_previoustap = 0; values.t_currenttap = 0; values.tapinterval = 0;
    values.current_nominal = 0; values.current_reproduced = 0; values.current_difference = 0;
    values.all_nominal = ""; values.all_reproduced = ""; values.all_differences = ""; ]
/ ontrialend = [values.nbeats = list.nbeats.nextvalue;]
/ stimulusframes = [1=rhythm]
/ validresponse = (0)
/ trialduration = 1000
/ branch = [trial.tap]
</trial>

<trial tap>
/ ontrialbegin = [if (values.tapcount > 0) values.current_nominal = list.nominal_intervals.nextvalue;]
/ ontrialbegin = [values.t_previoustap = values.t_currenttap; ]
/ ontrialend = [values.tapcount += 1]
/ ontrialend = [values.tapinterval = abs(values.t_currenttap - values.t_previoustap)]
/ ontrialend = [values.current_difference = values.tapinterval - values.current_nominal]
/ ontrialend = [if (values.tapcount > 1) {values.all_reproduced = concat(concat(values.all_reproduced, "|"), values.tapinterval);
    values.all_nominal = concat(concat(values.all_nominal, "|"), values.current_nominal);
    values.all_differences = concat(concat(values.all_differences, "|"), values.current_difference);}
    ]
/ stimulusframes = [1=summary]
/ isvalidresponse = [values.t_currenttap = script.elapsedtime; trial.tap.response == 57]
/ responsemessage = (57, systembeep, 0)
/ branch = [if (values.tapcount < values.nbeats) trial.tap else trial.summary]
</trial>

<trial summary>
/ ontrialbegin = [text.summary.textcolor = red]
/ ontrialend = [text.summary.textcolor = black]
/ stimulusframes = [1=summary]
/ validresponse = (57)
</trial>

<text rhythm>
/ items = rhythmitems
</text>

<item rhythmitems>
/ 1 = "Imagine rhythm1.wav playing..."
/ 2 = "Imagine rhythm2.wav playing..."
</item>

// holds the number of beats associated with the displayed rhythm
<list nbeats>
/ items = (8, 12)
/ selectionmode = text.rhythm.currentindex
</list>


// list of lists holding the nominal intervals associated with the displayed rhythm
<list nominal_intervals>
/ items = (list.r1_intervals.nextvalue, list.r2_intervals.nextvalue)
/ selectionmode = text.rhythm.currentindex
</list>

// intervals associated with rhythm1
<list r1_intervals>
/ items = (520,260,520,260,520,260,260)
/ selectionmode = sequence
</list>

// intervals associated with rhythm2
<list r2_intervals>
/ items = (520,130,260,260,130,260,260,130,130,260,520)
/ selectionmode = sequence
</list>

<text summary>
/ items = ("Nominal Intervals: <%values.all_nominal%>
~nReproduced Intervals: <%values.all_reproduced%>
~nDifferences: <%values.all_differences%>")
/ size = (75%, 75%)
/ erase = false
</text>

I've made it so you can see what's happening on-screen as the task progresses. For the final / "real" script, you'll of course want to log the various values holding the results of the calculations to the data file(s) instead.

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search