Embed Rhai-rs in Glicol for sample-level music/DSP live coding in web browsers #527
chaosprint
started this conversation in
Show and tell
Replies: 2 comments
-
There is a |
Beta Was this translation helpful? Give feedback.
0 replies
-
Yes, Rhai arrays hold If you need a typed array, you'd need to register its API. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
first, I would like to thank all the contributors of rhai especially @schungx
TL;DR
I have been exploring the possibility to embed a script language into my project glicol (graph-oriented live coding language) is a computer music language and an audio DSP lib written in Rust:
with rhai script, you can now write code like this to make music in web browsers:
a little bit more on the process
one limitation for Glicol before, and perhaps in many other computer music languages/live coding languages, is that there is no mechanism to support sample-level dsp live coding. in Max/MSP, there is an
object
called~gen
which is probably the most well-known for this purpose.I have been looking for options for this embedding language and finally landed on
rhai
.the syntax of
rhai
is really intuitive and I think it has merged the syntax sugar ofjs
andrust
.embedding Rhai in Glicol is a very straightforward experience thanks to its well-designed api and docs (rhai.rs)
now, users can write:
see the interactive example on https://glicol.org/guide#rhai2
from my current testing, for this real-time audio scripting, creating new variables, especially arrays should be avoided.
for now the
script
node providesoutout
,input
(if there is one),sr
andphase
to theScope
of rhai, as well as variables froma
toz
.x0
,x1
,x2
,y0
,y1
,y2
.I am still exploring the possibility to share a
ringbuf
in rhaiScope
; some functions such as random can also be useful.if you are interested, please give me some feedback here or on the github repo of glicol:
https://github.com/chaosprint/glicol
cheers!
Beta Was this translation helpful? Give feedback.
All reactions