| Reference | Downloads | Github

JS syntax error

URL of experiment:

Description of the problem:
I try to run my experiment online, so at first I tried to export HTML but it seems unsuccessful,the alert is as follows
“Alert 4210:JavaScript Syntax Error in ‘Begin JS Experiment’ tab. See ‘Line 12: Unexpected token’ in the ‘Begin JS Experiment’ tab.
For further info see 4210: Probable syntax error detected in your JavaScript code — PsychoPy v2021.1
My code in ‘Begin JS Experiment’ tab as show below:

import psychopy.voicekey as vk
vk.pyo_init(rate=44100, buffersize=32)
from psychopy.voicekey.demo_vks import DemoVoiceKeySignal as Signaler

index_list = [0] * 26
index_dic = dict(zip(Stim_list, index_list))

pic = [list(range(3))*2,list(range(3))*1,
[shuffle(i) for i in pic]
pic_dic = dict(zip(Stim_list,pic))
I am a new psychopy learner, and I don’t know what the syntax error is. I’ll appreciate it very much if you can help me. Many thanks!

I doubt that psychopy.voicekey works online.

1 Like

Thank you for your quick reply! I can run it offline. I have no idea if the voicekey can work online, my study is about speech production. :sweat_smile:

Now I know the mic is not supported online. Please look the following below:
But I still have no idea if so does the voicekey.

Isn’t the voicekey a piece of hardware?

Why would you want to run an experiment using bespoke hardware online? Your participants won’t own one.

:sweat_smile:Oh! I am new at psychopy, and actually I just wrote some codes to import voicekey.I want Vocal Rt,but microphone can’t make that, so I imported voicekey.
Sorry, I don’t understand what you said “bespoke hardware online?Your participants won’t own one.” I think I don’t own one,too,but it can work perfectly when I run my experiment offline.