Description of the problem: Using the builder, I am currently trying to build an online experiment in which each stimulus has a specific duration. However, when I set in the Stop parameter the name of my column of the .csv file containing the timing with the $ (e.g., $myDuration), in Pavlovia I get the following message right before the stimulus: * ReferenceError: asarray is not defined
Create a sound component in an earlier routine and set the start time to after you want the routine to end. You may therefore need to end the routine using continueRoutine=False
You can then start and stop the sound in code using .play() and .stop()
@Glen is right that you don’t need the $ in duration as it’s already marked as literal.
This is most likely a quirk of the JavaScript translation - in Pyhon, asarray is used to ensure that whatever value you give as the duration, it’s easy to operate on. It may be that an equivalent function either doesn’t exist in JavaScript or has a different name - which we need to account for when creating the JavaScript code. I’ll bring this up with the JS team and make sure we’re in sync!
Hello all. Any further developments on this issue? I ran into the same problem, I am trying to set variable stimuli durations but I receive the same error message when testing in pavlovia. @Daniele_G have you found a workaround?
In an earlier version this year, I used the following code in the Begin Routine JS part of a custom code component to implement a jitter and save it to the log:
I used to put in “$jitter” in the duration part of the respective text component that needed to be jittered.
Now, the following changed:
in addition to defining jitter the way described above I now write the following in the start experiment JS part (as suggested by wakecarter somewhere else):
asarray=function(jitter) {
return jitter;
}
also, I now need to put “jitter” without the dollar sign in the duration part of the respective text component that needs to be jittered