Group: Administrators
Posts: 13K,
Visits: 102K
|
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.
|