Show HN: Glicol - A Graph-Oriented Live Coding Language/DSP Lib Written in Rust
github.com
github.com
Recently I added support for VST, Bela and responsive design for mobile devices. It would be great if you can try and give me some feedback here or in the GitHub repo:
https://github.com/chaosprint/glicol
Thanks!
> Wow, glicol looks amazing! One of the few music languages I’ve seen which actually tries to balance low-level synthesis with higher-level sequencing. (The only other one I know of is extempore: https://extemporelang.github.io/)
[https://news.ycombinator.com/item?id=30753499]
Upon seeing it again, I am pleased to report that my impression has not changed at all.
What about SuperCollider?
That's cool!
FWIW, Mads has been working on a Faust UGen that can compile Faust code on the fly: https://github.com/madskjeldgaard/faustgen-supercollider
Also, there is an open-source implementation of Reaper's JSFX language: https://github.com/asb2m10/jsusfx. The Repo already contains Max and Pd objects. I have been thinking of contributing a SuperCollider UGen, but there are so many other things on my list :-)
FWIW, Pd and Max/MSP always had sample-level control in the sense that subpatches can be reblocked. For example, if you put a [block~ 1] object in a Pd subpatch, the process function will be called for every sample, so you can have single-sample feedback paths. Pd also has the [fexpr~] object which allows users to write FIR and IIR filters in a simple expression-syntax. Finally, Max/MSP offers the very powerful [gen~] object. You can check it out for inspiration (if you haven't already).
Pd (and Max/MSP) also allow to upsample/resample subpatches, which is important for minimizing aliasing (caused by certain kinds of processing, such as distortion).
Pd also uses the reblocking mechanism to implement FFT processing. The output of [rfft~] is just an ordinary signal that can be manipulated by the usual signal objects. You can also write the output to a table, manipulate it in the control domain with [bang~], and then read it back in the next DSP tick. IMO, this is a very powerful and elegant approach. SuperCollider, on the other hand, only supports a single global blocksize and samplerate which prevents temporary upsampling + anti-aliasing, severly limits single-sample feedback and leads to a rather awkward FFT implementation (you need dedicated PV_* objects for the most basic operations, such as addition and multiplication).
Another thing to think about is multi-threaded DSP. With Supernova, Tim Blechmann miraculously managed to retrofit multi-threading onto scsynth. Max/MSP offers some support for multi-threading (IIRC, top level patches and poly~ instances run in parallel). Recently, I have been working on adding multi-threading to Pd (it's working, but still very much experimental): https://github.com/Spacechild1/pure-data/tree/multi-threadin.... If you design an audio engine in 2022, multi-threading should be considered from the start; you don't have to implement it yet, but at least leave the door open to do it at a later stage.
Finally, every audio engine needs a plugin interface :-) That's where the problems really start, because for all of the things mentioned above, you have to offer proper abstractions to plugin clients.
---
I'm not sure how far you want to go with Glicol. I guess for the typical Algorave live coder all these things are probably not important. But if you want Glicol to be a flexible modern audio engine/library, you will have to think about FFT, upsampling, single-sample feedback, multi-processing etc. at some point. My advice is to not leave these things as an afterthought; you should at least think about it from the start while designing your engine - if you want to avoid some of the mistakes that other existing audio engines made. This is just a word of "warning" from someone having spent countless of hours in Pd and SuperCollider source code :-) If you come to the conclusion "I won't ever need any of this" - that's fine, of course!
---
That being said, Glicol looks very promising. Keep up the good work!
That thread actually ends with a link to Mads' Faust UGen :-)
Is it possible to build an effect written in Glicol into an iOS app or effect (AudioUnit v3? haven't been keeping up)? LV2 plugin to run on MOD devices guitar pedals? VCVRack, which has its own plugin interface? onto a Rasp Pi Zero?
https://docs.rs/lv2/latest/lv2/
https://docs.rs/vst/latest/vst/
And for Rasp Pi or Bela, Glicol can also help. Although these are all work in progress, I personally really enjoy coding in Rust and the package management is fantastic.
However, VCVRack seems to be a different story; Faust may be a better option:
https://faustdoc.grame.fr/workshops/2020-11-21-faust-vcvrack...
Live Coding Dattorro Plate Reverb in Your Favourite DAWs with Glicol VST Plugin
More videos on this list:
https://youtube.com/playlist?list=PLT4REhRBWaOOrLQxCg5Uw97gE...
I make electronic music as a hobby and have wanted to make my own VST, but it has proven to be more pain than fun. This looks like a very promising candidate!
For now, Glicol can be used as a VST plguin, where you can write audo logic with Glicol syntax: https://youtu.be/yFKH9ou_XyQ
If you want your own vst (with your name on the author and you can sell),you can start with vst-rs:
https://github.com/RustAudio/vst-rs
Wanna some GUI, here is a template: https://github.com/DGriffin91/egui_baseview_test_vst2
In writing the vst, you may need some rust audio lib, you can search dasp, fundsp, or wait for glicol_synth published as a Rust crate (like pip or npm)
However, I have checked some generated Rust code from Faust and found it relies on some unsafe blocks there. My concern is if one wishes to use Rust for audio, it doesn't make a lot of sense not to control all the details and make sure of the safety in detail.
The other concern is the incompatibility of license. In Rust community, MIT or Apache are more popular for further usage.
For VST, Glicol can run in vst and support sample-level control: https://youtu.be/yFKH9ou_XyQ
Still a POC for now, and I need to make the input working. But I am not very optimistic for many use cases in VST. I think two main goals for Glicol is collaborative live coding in browsers and quick prototyping on Bela.
btw., feel free to share on Rust Audio forum: https://rust-audio.discourse.group
also the VST integration is fire, i think people would build amazing stuff with it
Thus, Glicol's audio engine will soon be published as a Rust crate: https://github.com/chaosprint/glicol/tree/main/rs/synth
Still, for the VST, I kinda feel that users may find it easier to use Max4Live or PD-VST (e.g https://github.com/pierreguillot/Camomile) rather than a text-based language, since VST is already a graphic interface :)