krmanning10
|
|
Group: Forum Members
Posts: 4,
Visits: 7
|
Hello! I am currently trying to code a trial where participants press a key at a specific moment in a trial. There is a moving bar that loops, and they need to press the space bar when it lines up with certain shapes in the background. Depending on where they press the spacebar, a different sound is played. And each loop does not have the same sounds as the previous loop. There are 6 loops total. How can I code Inquisit to play a different sound based on the frequency of key presses, and how do I link that to a particular key?
|
|
|
Dave
|
|
Group: Administrators
Posts: 13K,
Visits: 108K
|
+xHello! I am currently trying to code a trial where participants press a key at a specific moment in a trial. There is a moving bar that loops, and they need to press the space bar when it lines up with certain shapes in the background. Depending on where they press the spacebar, a different sound is played. And each loop does not have the same sounds as the previous loop. There are 6 loops total. How can I code Inquisit to play a different sound based on the frequency of key presses, and how do I link that to a particular key? Please provide example code. It's entirely unclear what you refer to as "loop" and how you implemented it.
|
|
|
krmanning10
|
|
Group: Forum Members
Posts: 4,
Visits: 7
|
+x+xHello! I am currently trying to code a trial where participants press a key at a specific moment in a trial. There is a moving bar that loops, and they need to press the space bar when it lines up with certain shapes in the background. Depending on where they press the spacebar, a different sound is played. And each loop does not have the same sounds as the previous loop. There are 6 loops total. How can I code Inquisit to play a different sound based on the frequency of key presses, and how do I link that to a particular key? Please provide example code. It's entirely unclear what you refer to as "loop" and how you implemented it. <values> / noteCount = 0 </values> <trial instructions> / preTrialPause = 500 / stimulusframes = [1=tasktext; 1=musicline; 2=line1; 3=line2; 4=line3; 5=line4; 6=line5; 7=line6; 8=line7] / validResponse = (" ") / responseTrial = (" ", synchrony) </trial> <trial synchrony> / preTrialPause = 500 / stimulusframes = [1=musicline; 2=line1; 3=line2; 4=line3; 5=line4; 6=line5; 7=line6; 8=line7] / validResponse = (" ") / ontrialend = [ values.noteCount += 1 ] </trial> Right now I'm trying to have noteCount increase by 1 for every key pressed. And I would like to use the number of key presses to control which sound is coming out. So if noteCount is 1, 2, or 14 for example, it plays soundA.
|
|
|
Dave
|
|
Group: Administrators
Posts: 13K,
Visits: 108K
|
+x+x+xHello! I am currently trying to code a trial where participants press a key at a specific moment in a trial. There is a moving bar that loops, and they need to press the space bar when it lines up with certain shapes in the background. Depending on where they press the spacebar, a different sound is played. And each loop does not have the same sounds as the previous loop. There are 6 loops total. How can I code Inquisit to play a different sound based on the frequency of key presses, and how do I link that to a particular key? Please provide example code. It's entirely unclear what you refer to as "loop" and how you implemented it. <values> / noteCount = 0 </values> <trial instructions> / preTrialPause = 500 / stimulusframes = [1=tasktext; 1=musicline; 2=line1; 3=line2; 4=line3; 5=line4; 6=line5; 7=line6; 8=line7] / validResponse = (" ") / responseTrial = (" ", synchrony) </trial> <trial synchrony> / preTrialPause = 500 / stimulusframes = [1=musicline; 2=line1; 3=line2; 4=line3; 5=line4; 6=line5; 7=line6; 8=line7] / validResponse = (" ") / ontrialend = [ values.noteCount += 1 ] </trial> Right now I'm trying to have noteCount increase by 1 for every key pressed. And I would like to use the number of key presses to control which sound is coming out. So if noteCount is 1, 2, or 14 for example, it plays soundA. Please provide code one can actually run, i.e. that includes the definitions for all elements referenced. Also, if your code requires any files (images, sound files) you should provide those as well. Further, please comment your code and provide more than vague one or two sentence descriptions of what it is supposed to do.
|
|
|
krmanning10
|
|
Group: Forum Members
Posts: 4,
Visits: 7
|
+x+x+x+xHello! I am currently trying to code a trial where participants press a key at a specific moment in a trial. There is a moving bar that loops, and they need to press the space bar when it lines up with certain shapes in the background. Depending on where they press the spacebar, a different sound is played. And each loop does not have the same sounds as the previous loop. There are 6 loops total. How can I code Inquisit to play a different sound based on the frequency of key presses, and how do I link that to a particular key? Please provide example code. It's entirely unclear what you refer to as "loop" and how you implemented it. <values> / noteCount = 0 </values> <trial instructions> / preTrialPause = 500 / stimulusframes = [1=tasktext; 1=musicline; 2=line1; 3=line2; 4=line3; 5=line4; 6=line5; 7=line6; 8=line7] / validResponse = (" ") / responseTrial = (" ", synchrony) </trial> <trial synchrony> / preTrialPause = 500 / stimulusframes = [1=musicline; 2=line1; 3=line2; 4=line3; 5=line4; 6=line5; 7=line6; 8=line7] / validResponse = (" ") / ontrialend = [ values.noteCount += 1 ] </trial> Right now I'm trying to have noteCount increase by 1 for every key pressed. And I would like to use the number of key presses to control which sound is coming out. So if noteCount is 1, 2, or 14 for example, it plays soundA. Please provide code one can actually run, i.e. that includes the definitions for all elements referenced. Also, if your code requires any files (images, sound files) you should provide those as well. Further, please comment your code and provide more than vague one or two sentence descriptions of what it is supposed to do. The block to run: <block task> / trials = [1=synchrony] </block> The bar that moves across the screen: <shape musicline> / shape = rectangle / color = crimson / size = (2%,100%) / animation = path(7250, 6, 5%, 50%, 85%, 50%) </shape> 7 shapes that the bar will pass over: <shape line1> / shape = rectangle / color = black / size = (2%,50%) / position = (20%, 50%) </shape> <shape line2> / shape = rectangle / color = black / size = (2%,50%) / position = (30%, 50%) </shape> <shape line3> / shape = rectangle / color = black / size = (2%,50%) / position = (40%, 50%) </shape> <shape line4> / shape = rectangle / color = black / size = (2%,50%) / position = (50%, 50%) </shape> <shape line5> / shape = rectangle / color = black / size = (2%,50%) / position = (60%, 50%) </shape> <shape line6> / shape = rectangle / color = black / size = (2%,50%) / position = (70%, 50%) </shape> <shape line7> / shape = rectangle / color = black / size = (2%,50%) / position = (80%, 50%) </shape> noteCount value: <values> / noteCount = 0 </values> The trial where the bar moves across the rectangles, and should be playing a sound. <trial synchrony> / preTrialPause = 500 / stimulusframes = [1=musicline; 2=line1; 3=line2; 4=line3; 5=line4; 6=line5; 7=line6; 8=line7] / validResponse = (" ") / ontrialend = [ if (values.noteCount < 50) { values.noteCount += 1;} ] </trial> The sound files to play: <sound noteC> / items = ("Twinkle_Twinkle_Little_Star_C.mp3") </sound> <sound noteG> / items = ("Twinkle_Twinkle_Little_Star_G.mp3") </sound> <sound noteA> / items = ("Twinkle_Twinkle_Little_Star_A.mp3") </sound> <sound noteF> / items = ("Twinkle_Twinkle_Little_Star_F.mp3") </sound> <sound noteE> / items = ("Twinkle_Twinkle_Little_Star_E.mp3") </sound> <sound noteD> / items = ("Twinkle_Twinkle_Little_Star_D.mp3") </sound> Unfortunately the program is not letting me upload the specific sound files, but any can be used for testing.
|
|
|
Dave
|
|
Group: Administrators
Posts: 13K,
Visits: 108K
|
+x+x+x+x+xHello! I am currently trying to code a trial where participants press a key at a specific moment in a trial. There is a moving bar that loops, and they need to press the space bar when it lines up with certain shapes in the background. Depending on where they press the spacebar, a different sound is played. And each loop does not have the same sounds as the previous loop. There are 6 loops total. How can I code Inquisit to play a different sound based on the frequency of key presses, and how do I link that to a particular key? Please provide example code. It's entirely unclear what you refer to as "loop" and how you implemented it. <values> / noteCount = 0 </values> <trial instructions> / preTrialPause = 500 / stimulusframes = [1=tasktext; 1=musicline; 2=line1; 3=line2; 4=line3; 5=line4; 6=line5; 7=line6; 8=line7] / validResponse = (" ") / responseTrial = (" ", synchrony) </trial> <trial synchrony> / preTrialPause = 500 / stimulusframes = [1=musicline; 2=line1; 3=line2; 4=line3; 5=line4; 6=line5; 7=line6; 8=line7] / validResponse = (" ") / ontrialend = [ values.noteCount += 1 ] </trial> Right now I'm trying to have noteCount increase by 1 for every key pressed. And I would like to use the number of key presses to control which sound is coming out. So if noteCount is 1, 2, or 14 for example, it plays soundA. Please provide code one can actually run, i.e. that includes the definitions for all elements referenced. Also, if your code requires any files (images, sound files) you should provide those as well. Further, please comment your code and provide more than vague one or two sentence descriptions of what it is supposed to do. The block to run: <block task> / trials = [1=synchrony] </block> The bar that moves across the screen: <shape musicline> / shape = rectangle / color = crimson / size = (2%,100%) / animation = path(7250, 6, 5%, 50%, 85%, 50%) </shape> 7 shapes that the bar will pass over: <shape line1> / shape = rectangle / color = black / size = (2%,50%) / position = (20%, 50%) </shape> <shape line2> / shape = rectangle / color = black / size = (2%,50%) / position = (30%, 50%) </shape> <shape line3> / shape = rectangle / color = black / size = (2%,50%) / position = (40%, 50%) </shape> <shape line4> / shape = rectangle / color = black / size = (2%,50%) / position = (50%, 50%) </shape> <shape line5> / shape = rectangle / color = black / size = (2%,50%) / position = (60%, 50%) </shape> <shape line6> / shape = rectangle / color = black / size = (2%,50%) / position = (70%, 50%) </shape> <shape line7> / shape = rectangle / color = black / size = (2%,50%) / position = (80%, 50%) </shape> noteCount value: <values> / noteCount = 0 </values> The trial where the bar moves across the rectangles, and should be playing a sound. <trial synchrony> / preTrialPause = 500 / stimulusframes = [1=musicline; 2=line1; 3=line2; 4=line3; 5=line4; 6=line5; 7=line6; 8=line7] / validResponse = (" ") / ontrialend = [ if (values.noteCount < 50) { values.noteCount += 1;} ] </trial> The sound files to play: <sound noteC> / items = ("Twinkle_Twinkle_Little_Star_C.mp3") </sound> <sound noteG> / items = ("Twinkle_Twinkle_Little_Star_G.mp3") </sound> <sound noteA> / items = ("Twinkle_Twinkle_Little_Star_A.mp3") </sound> <sound noteF> / items = ("Twinkle_Twinkle_Little_Star_F.mp3") </sound> <sound noteE> / items = ("Twinkle_Twinkle_Little_Star_E.mp3") </sound> <sound noteD> / items = ("Twinkle_Twinkle_Little_Star_D.mp3") </sound> Unfortunately the program is not letting me upload the specific sound files, but any can be used for testing. You can put files in a ZIP and attach it. You sitll have not provided any sufficient explanation of what this is intended to do, what sound to play when, etc.
|
|
|
krmanning10
|
|
Group: Forum Members
Posts: 4,
Visits: 7
|
+x+x+x+x+x+xHello! I am currently trying to code a trial where participants press a key at a specific moment in a trial. There is a moving bar that loops, and they need to press the space bar when it lines up with certain shapes in the background. Depending on where they press the spacebar, a different sound is played. And each loop does not have the same sounds as the previous loop. There are 6 loops total. How can I code Inquisit to play a different sound based on the frequency of key presses, and how do I link that to a particular key? Please provide example code. It's entirely unclear what you refer to as "loop" and how you implemented it. <values> / noteCount = 0 </values> <trial instructions> / preTrialPause = 500 / stimulusframes = [1=tasktext; 1=musicline; 2=line1; 3=line2; 4=line3; 5=line4; 6=line5; 7=line6; 8=line7] / validResponse = (" ") / responseTrial = (" ", synchrony) </trial> <trial synchrony> / preTrialPause = 500 / stimulusframes = [1=musicline; 2=line1; 3=line2; 4=line3; 5=line4; 6=line5; 7=line6; 8=line7] / validResponse = (" ") / ontrialend = [ values.noteCount += 1 ] </trial> Right now I'm trying to have noteCount increase by 1 for every key pressed. And I would like to use the number of key presses to control which sound is coming out. So if noteCount is 1, 2, or 14 for example, it plays soundA. Please provide code one can actually run, i.e. that includes the definitions for all elements referenced. Also, if your code requires any files (images, sound files) you should provide those as well. Further, please comment your code and provide more than vague one or two sentence descriptions of what it is supposed to do. The block to run: <block task> / trials = [1=synchrony] </block> The bar that moves across the screen: <shape musicline> / shape = rectangle / color = crimson / size = (2%,100%) / animation = path(7250, 6, 5%, 50%, 85%, 50%) </shape> 7 shapes that the bar will pass over: <shape line1> / shape = rectangle / color = black / size = (2%,50%) / position = (20%, 50%) </shape> <shape line2> / shape = rectangle / color = black / size = (2%,50%) / position = (30%, 50%) </shape> <shape line3> / shape = rectangle / color = black / size = (2%,50%) / position = (40%, 50%) </shape> <shape line4> / shape = rectangle / color = black / size = (2%,50%) / position = (50%, 50%) </shape> <shape line5> / shape = rectangle / color = black / size = (2%,50%) / position = (60%, 50%) </shape> <shape line6> / shape = rectangle / color = black / size = (2%,50%) / position = (70%, 50%) </shape> <shape line7> / shape = rectangle / color = black / size = (2%,50%) / position = (80%, 50%) </shape> noteCount value: <values> / noteCount = 0 </values> The trial where the bar moves across the rectangles, and should be playing a sound. <trial synchrony> / preTrialPause = 500 / stimulusframes = [1=musicline; 2=line1; 3=line2; 4=line3; 5=line4; 6=line5; 7=line6; 8=line7] / validResponse = (" ") / ontrialend = [ if (values.noteCount < 50) { values.noteCount += 1;} ] </trial> The sound files to play: <sound noteC> / items = ("Twinkle_Twinkle_Little_Star_C.mp3") </sound> <sound noteG> / items = ("Twinkle_Twinkle_Little_Star_G.mp3") </sound> <sound noteA> / items = ("Twinkle_Twinkle_Little_Star_A.mp3") </sound> <sound noteF> / items = ("Twinkle_Twinkle_Little_Star_F.mp3") </sound> <sound noteE> / items = ("Twinkle_Twinkle_Little_Star_E.mp3") </sound> <sound noteD> / items = ("Twinkle_Twinkle_Little_Star_D.mp3") </sound> Unfortunately the program is not letting me upload the specific sound files, but any can be used for testing. You can put files in a ZIP and attach it. You sitll have not provided any sufficient explanation of what this is intended to do, what sound to play when, etc. This is intended to run a trial where the musicline shape is moving in a path over 7 rectangles (the line shapes). When the musicline overlaps with the first and second rectangle, the participant should press the spacebar each time and it should play noteC. When the musicline overlaps with the third and fourth rectangle, it should play noteG. The participant is essentially trying to play the rhythm of a song by pressing the spacebar at the right time, which is indicated by the rectangles.
|
|
|
Dave
|
|
Group: Administrators
Posts: 13K,
Visits: 108K
|
+x+x+x+x+x+x+xHello! I am currently trying to code a trial where participants press a key at a specific moment in a trial. There is a moving bar that loops, and they need to press the space bar when it lines up with certain shapes in the background. Depending on where they press the spacebar, a different sound is played. And each loop does not have the same sounds as the previous loop. There are 6 loops total. How can I code Inquisit to play a different sound based on the frequency of key presses, and how do I link that to a particular key? Please provide example code. It's entirely unclear what you refer to as "loop" and how you implemented it. <values> / noteCount = 0 </values> <trial instructions> / preTrialPause = 500 / stimulusframes = [1=tasktext; 1=musicline; 2=line1; 3=line2; 4=line3; 5=line4; 6=line5; 7=line6; 8=line7] / validResponse = (" ") / responseTrial = (" ", synchrony) </trial> <trial synchrony> / preTrialPause = 500 / stimulusframes = [1=musicline; 2=line1; 3=line2; 4=line3; 5=line4; 6=line5; 7=line6; 8=line7] / validResponse = (" ") / ontrialend = [ values.noteCount += 1 ] </trial> Right now I'm trying to have noteCount increase by 1 for every key pressed. And I would like to use the number of key presses to control which sound is coming out. So if noteCount is 1, 2, or 14 for example, it plays soundA. Please provide code one can actually run, i.e. that includes the definitions for all elements referenced. Also, if your code requires any files (images, sound files) you should provide those as well. Further, please comment your code and provide more than vague one or two sentence descriptions of what it is supposed to do. The block to run: <block task> / trials = [1=synchrony] </block> The bar that moves across the screen: <shape musicline> / shape = rectangle / color = crimson / size = (2%,100%) / animation = path(7250, 6, 5%, 50%, 85%, 50%) </shape> 7 shapes that the bar will pass over: <shape line1> / shape = rectangle / color = black / size = (2%,50%) / position = (20%, 50%) </shape> <shape line2> / shape = rectangle / color = black / size = (2%,50%) / position = (30%, 50%) </shape> <shape line3> / shape = rectangle / color = black / size = (2%,50%) / position = (40%, 50%) </shape> <shape line4> / shape = rectangle / color = black / size = (2%,50%) / position = (50%, 50%) </shape> <shape line5> / shape = rectangle / color = black / size = (2%,50%) / position = (60%, 50%) </shape> <shape line6> / shape = rectangle / color = black / size = (2%,50%) / position = (70%, 50%) </shape> <shape line7> / shape = rectangle / color = black / size = (2%,50%) / position = (80%, 50%) </shape> noteCount value: <values> / noteCount = 0 </values> The trial where the bar moves across the rectangles, and should be playing a sound. <trial synchrony> / preTrialPause = 500 / stimulusframes = [1=musicline; 2=line1; 3=line2; 4=line3; 5=line4; 6=line5; 7=line6; 8=line7] / validResponse = (" ") / ontrialend = [ if (values.noteCount < 50) { values.noteCount += 1;} ] </trial> The sound files to play: <sound noteC> / items = ("Twinkle_Twinkle_Little_Star_C.mp3") </sound> <sound noteG> / items = ("Twinkle_Twinkle_Little_Star_G.mp3") </sound> <sound noteA> / items = ("Twinkle_Twinkle_Little_Star_A.mp3") </sound> <sound noteF> / items = ("Twinkle_Twinkle_Little_Star_F.mp3") </sound> <sound noteE> / items = ("Twinkle_Twinkle_Little_Star_E.mp3") </sound> <sound noteD> / items = ("Twinkle_Twinkle_Little_Star_D.mp3") </sound> Unfortunately the program is not letting me upload the specific sound files, but any can be used for testing. You can put files in a ZIP and attach it. You sitll have not provided any sufficient explanation of what this is intended to do, what sound to play when, etc. This is intended to run a trial where the musicline shape is moving in a path over 7 rectangles (the line shapes). When the musicline overlaps with the first and second rectangle, the participant should press the spacebar each time and it should play noteC. When the musicline overlaps with the third and fourth rectangle, it should play noteG. The participant is essentially trying to play the rhythm of a song by pressing the spacebar at the right time, which is indicated by the rectangles. That's not going to work this way. You'll essentially have to break up the trials and animation in to one per line, a continuous animation in a single trial cannot work because you cannot change what the trial does once it's runing (e.g. play a different sound depending on where the animation is when the space bar is pressed).
|
|
|
Dave
|
|
Group: Administrators
Posts: 13K,
Visits: 108K
|
+x+x+x+x+x+x+x+xHello! I am currently trying to code a trial where participants press a key at a specific moment in a trial. There is a moving bar that loops, and they need to press the space bar when it lines up with certain shapes in the background. Depending on where they press the spacebar, a different sound is played. And each loop does not have the same sounds as the previous loop. There are 6 loops total. How can I code Inquisit to play a different sound based on the frequency of key presses, and how do I link that to a particular key? Please provide example code. It's entirely unclear what you refer to as "loop" and how you implemented it. <values> / noteCount = 0 </values> <trial instructions> / preTrialPause = 500 / stimulusframes = [1=tasktext; 1=musicline; 2=line1; 3=line2; 4=line3; 5=line4; 6=line5; 7=line6; 8=line7] / validResponse = (" ") / responseTrial = (" ", synchrony) </trial> <trial synchrony> / preTrialPause = 500 / stimulusframes = [1=musicline; 2=line1; 3=line2; 4=line3; 5=line4; 6=line5; 7=line6; 8=line7] / validResponse = (" ") / ontrialend = [ values.noteCount += 1 ] </trial> Right now I'm trying to have noteCount increase by 1 for every key pressed. And I would like to use the number of key presses to control which sound is coming out. So if noteCount is 1, 2, or 14 for example, it plays soundA. Please provide code one can actually run, i.e. that includes the definitions for all elements referenced. Also, if your code requires any files (images, sound files) you should provide those as well. Further, please comment your code and provide more than vague one or two sentence descriptions of what it is supposed to do. The block to run: <block task> / trials = [1=synchrony] </block> The bar that moves across the screen: <shape musicline> / shape = rectangle / color = crimson / size = (2%,100%) / animation = path(7250, 6, 5%, 50%, 85%, 50%) </shape> 7 shapes that the bar will pass over: <shape line1> / shape = rectangle / color = black / size = (2%,50%) / position = (20%, 50%) </shape> <shape line2> / shape = rectangle / color = black / size = (2%,50%) / position = (30%, 50%) </shape> <shape line3> / shape = rectangle / color = black / size = (2%,50%) / position = (40%, 50%) </shape> <shape line4> / shape = rectangle / color = black / size = (2%,50%) / position = (50%, 50%) </shape> <shape line5> / shape = rectangle / color = black / size = (2%,50%) / position = (60%, 50%) </shape> <shape line6> / shape = rectangle / color = black / size = (2%,50%) / position = (70%, 50%) </shape> <shape line7> / shape = rectangle / color = black / size = (2%,50%) / position = (80%, 50%) </shape> noteCount value: <values> / noteCount = 0 </values> The trial where the bar moves across the rectangles, and should be playing a sound. <trial synchrony> / preTrialPause = 500 / stimulusframes = [1=musicline; 2=line1; 3=line2; 4=line3; 5=line4; 6=line5; 7=line6; 8=line7] / validResponse = (" ") / ontrialend = [ if (values.noteCount < 50) { values.noteCount += 1;} ] </trial> The sound files to play: <sound noteC> / items = ("Twinkle_Twinkle_Little_Star_C.mp3") </sound> <sound noteG> / items = ("Twinkle_Twinkle_Little_Star_G.mp3") </sound> <sound noteA> / items = ("Twinkle_Twinkle_Little_Star_A.mp3") </sound> <sound noteF> / items = ("Twinkle_Twinkle_Little_Star_F.mp3") </sound> <sound noteE> / items = ("Twinkle_Twinkle_Little_Star_E.mp3") </sound> <sound noteD> / items = ("Twinkle_Twinkle_Little_Star_D.mp3") </sound> Unfortunately the program is not letting me upload the specific sound files, but any can be used for testing. You can put files in a ZIP and attach it. You sitll have not provided any sufficient explanation of what this is intended to do, what sound to play when, etc. This is intended to run a trial where the musicline shape is moving in a path over 7 rectangles (the line shapes). When the musicline overlaps with the first and second rectangle, the participant should press the spacebar each time and it should play noteC. When the musicline overlaps with the third and fourth rectangle, it should play noteG. The participant is essentially trying to play the rhythm of a song by pressing the spacebar at the right time, which is indicated by the rectangles. That's not going to work this way. You'll essentially have to break up the trials and animation in to one per line, a continuous animation in a single trial cannot work because you cannot change what the trial does once it's runing (e.g. play a different sound depending on where the animation is when the space bar is pressed). Here's a rough sketch of how this *might* work: <block task> / trials = [1=synchrony] </block>
<values> / repCount = 0 / xAtResponse = 0 / musicLineStartX = 5% // start x coordinate of animation / musicLineEndX = 85% // end x coordinate of animation / musicLineDuration = 7250 // duration of full animation </values>
The bar that moves across the screen: <shape musicline> / shape = rectangle / color = crimson / size = (2%,100%) / animation = path(values.musicLineDuration, -1, values.musicLineStartX, 50%, values.musicLineEndX, 50%) / erase = false </shape>
7 shapes that the bar will pass over: <shape line1> / shape = rectangle / color = black / size = (2%,50%) / position = (20%, 50%) / erase = false </shape>
<shape line2> / shape = rectangle / color = black / size = (2%,50%) / position = (30%, 50%) / erase = false </shape>
<shape line3> / shape = rectangle / color = black / size = (2%,50%) / position = (40%, 50%) / erase = false </shape>
<shape line4> / shape = rectangle / color = black / size = (2%,50%) / position = (50%, 50%) / erase = false </shape>
<shape line5> / shape = rectangle / color = black / size = (2%,50%) / position = (60%, 50%) / erase = false </shape>
<shape line6> / shape = rectangle / color = black / size = (2%,50%) / position = (70%, 50%) / erase = false </shape>
<shape line7> / shape = rectangle / color = black / size = (2%,50%) / position = (80%, 50%) / erase = false </shape>
<text debug> / items = ("X position at time of response: <%values.xAtResponse%> | Remaining duration: <%values.musicLineDuration%> | Repetition: <%values.repCount%>") / position = (50%, 10%) / erase = false </text>
The trial where the bar moves across the rectangles, and should be playing a sound. <trial synchrony> / onTrialBegin = [ // we start out playing no note, skipping all of them sound.noteA.skip = true; sound.noteC.skip = true; sound.noteD.skip = true; sound.noteE.skip = true; sound.noteF.skip = true; sound.noteG.skip = true; // if animation over line 1 or 2 at the time of response, we enable noteC if ((values.xAtResponse >= 19pct && values.xAtResponse <= 21pct) || (values.xAtResponse >= 29pct && values.xAtResponse <= 31pct)) { sound.noteC.skip = false; }; // if over line 3, 4, or 7 we enable note G if ((values.xAtResponse >= 39pct && values.xAtResponse <= 41pct) || (values.xAtResponse >= 49pct && values.xAtResponse <= 51pct) || (values.xAtResponse >= 79pct && values.xAtResponse <= 81pct)) { sound.noteG.skip = false; }; // if over line 5 or 6, we enable note A if ((values.xAtResponse >= 59pct && values.xAtResponse <= 61pct) || (values.xAtResponse >= 69pct && values.xAtResponse <= 71pct)) { sound.noteA.skip = false; }; ] / stimulusframes = [ 1=clearScreen, musicline, line1, line2, line3, line4, line5, line6, line7, noteA, noteC, noteD, noteE, noteF, noteG, debug] / beginResponseTime = -1 / validResponse = (" ") / isValidResponse = [ if (trial.synchrony.response == 57) { values.xAtResponse = shape.musicline.xPct; // store X coordinate of music line at time of response values.musicLineDuration -= trial.synchrony.latency; // calculate remaining animation duration values.musicLineStartX = values.xAtResponse; // set new start point, picking back up where we were at time of last response return true; }; ] / onTrialEnd = [ if (values.musicLineDuration <= 0 || trial.synchrony.response == 0) { // if trial times out, we reset everything values.musicLineStartX = 5%; // back to the original start position values.musicLineDuration = 7250; // back to original duration values.xAtResponse = 0%; // we don't have any response yet values.repCount += 1; // we increase the repetition count }; ] / branch = [ if (values.repCount < 5) { return trial.synchrony } ] / timeout = values.musicLineDuration </trial>
The sound files to play: <sound noteC> / items = ("Twinkle_Twinkle_Little_Star_C.mp3") / playThrough = false / erase = false </sound>
<sound noteG> / items = ("Twinkle_Twinkle_Little_Star_G.mp3") / playThrough = false / erase = false </sound>
<sound noteA> / items = ("Twinkle_Twinkle_Little_Star_A.mp3") / playThrough = false / erase = false </sound>
<sound noteF> / items = ("Twinkle_Twinkle_Little_Star_F.mp3") / playThrough = false / erase = false </sound>
<sound noteE> / items = ("Twinkle_Twinkle_Little_Star_E.mp3") / playThrough = false / erase = false </sound>
<sound noteD> / items = ("Twinkle_Twinkle_Little_Star_D.mp3") / playThrough = false / erase = false </sound> You'll have to toy around with how little or how much wiggle room you want to allow to consider a response a hit, i.e. how exact you want the line-up at the time of respose to be.
|
|
|