mimic-sussex / sema

Sema – A Playground for Live Coding Music and Machine Learning
https://sema.codes
MIT License
151 stars 51 forks source link

code library injection from JS window #400

Open chriskiefer opened 2 years ago

chriskiefer commented 2 years ago

It would be really useful to be able to inject global scope functions into the audio engine, so you can maintain a lib of code (synths, utility) without having to evaluate every time. You could send these from the JS window, in the current language; they could be parsed then evaluated in the audio engine.

could be a useful dev feature too.

sema.inject("func:(x:@{{x:}sawb, {{x:,1.01}mul}rectb}mix);")

sema.injectJS("var mysynth = ()=>{this.x = new maxiOsc(); return ()->{return this.x.saw(200)}}")