Inspired by the math and numjs libraries conversation,
I got p5.speech to work somewhat.
I use Windows10.
The selection of voices is a little different when running in Chrome.
(I couldn't get speechRec to work yet.)
(An error occurs if the print statement is uncommented.
It seems the error is associated with the get_library command for p5.min.js .
[Comment out all of the voice statements except for this get_library statement.]
)
Rob S.
GlowScript 3.0 VPython
#
# robphy (12/03/2020)
# using p5.speech
#
R=5
S0=sphere()
S=sphere(pos=R*vector(1,0,0),color=color.red)
voc = new p5.Speech()
voc.interrupt=False
voc.speak('glowscript is')
voc.setPitch(1.9)
voc.speak('way cool')
voc.interrupt=True # voc.cancel()
sleep(1)
t=0
dt=0.02
twopi=2*pi
while(True):
rate(30) #not too fast!
t +=dt
S.pos=R*vector(cos(t*twopi),sin(t*twopi),0)
if floor(t+dt)>floor(t):
voc.setVoice(floor(29*random()+0.5))
voc.setPitch(0.01+random()*1.99)
voc.setRate(0.5+random()*1.5)
voc.speak(floor(t+dt))
#print(S.pos) # uncommenting will cause an error (due to p5.min.js?? )