Explain HN: Glicol – A Graph-Oriented Dwell Coding Language/DSP Lib Written in Rust

113

Meet this fabulous item.

Glicol (an acronym for “graph-oriented stay coding language”) is a laptop song language and an audio DSP library written in Rust.

Glicol would be mature for:

  • stay coding efficiency
  • education of electronic song, DSP and coding
  • audio/song pattern as a JavaScript or Rust audio library, working on Internet, Desktop, DAW, Bela, and a great deal of others.

The absolute most real looking approach to utilize a study Glicol:

https://glicol.org

There you might perhaps perhaps perhaps salvage guides, demos, clinical doctors, and apps for collaboration.

Why Glicol

The incentive of Glicol is:

  • to support of us with zero records of coding and song production to originate with stay coding

  • to give experienced song coders a tool for posthaste prototyping and hacking

In NIME neighborhood, it’s known as:

low entry payment and excessive ceilings

Here is Glicol’s philosophy to approach these desires:

  • originate the language from a brand original instrument originate level of view

  • embrace the spirit of the cyber web for an even bigger trip

Mirrored in the implementation:

  • Glicol adopts a graph-oriented paradigm

  • Glicol would be mature in browsers with zero-installation

Graph-oriented

The elementary draw of Glicol is to connect a vary of nodes like synth modules.

All you will must know is the audio enter/output behaviour of each node.

Two programs for connecting: >> and ~reference:

// amplitude modulation and slothful evaluate example
// chain with ~ is a ref chain and can no longer be despatched to the DAC

o: sin 440>> mul ~amp
~amp: sin 1.0>> mul 0.3>> add 0.5

It additionally applies to sequencer and sampler:

// sequencer pattern
// first divide one bar with home
// then extra divide each portion in step with midi quantity and leisure(_)

o: velocity 2.0>> seq 60 _~a _ 48__67
>> sp blip

// quantity alters likelihood
~a: rob 60 60 0 0 72 72

As talked about above, you might perhaps perhaps perhaps strive these examples on:

https://glicol.org

When you could, you might perhaps perhaps perhaps even hear how a seq node work:

o: velocity 2.0>> seq 60 _72 _ 48__67>> mul 0.5

Here is that if reality be told analogous to how hardware module cross signals.

It’s extremely easy to undergo in thoughts and to originate.

When Glicol is mature in education, we are in a position to let students scrutinize and hear each node, even at the side of ‘envelope’.

Obliging leave the introduction of info kinds, Object or Characteristic later when we combine JavaScript with Glicol.

Zero-installation

For the audio engine, rather than mapping it to current audio lib like SuperCollider, I rob to preserve out it the onerous blueprint:

  • write the parser in Rust

  • write the audio engine in Rust that works seamlessly with the AST processing

  • port it to browsers using WebAssembly, AudioWorklet and SharedArrayBuffer

The precious reason is to uncover performant audio in browsers for straight forward entry and stay coding collaboration.

The reward is that we’ve an Rust audio lib known as glicol_synth:

It will scamper on Internet, Desktop, DAW, Bela board, and a great deal of others.

And one extra thing.

To write everything from low-stage additionally opens the door for meta node.

Now I can current to students, the hi there world tone can additionally be written in this way:

o: meta `
    output.pad(128, 0.0);
    for i in 0..128 {
        output[i]=sin(2*PI()*section) ;
        section +=440.0 / sr;
    };
    whereas section> 1.0 { section -=1.0 };
    output
`

Utilize Glicol

In browsers

Some aspects would be highlighted with the catch app:

  • garbage-sequence-free true-time audio in web browsers

  • posthaste reference in consoles with alt-d

  • the catch app routinely masses samples; you might perhaps perhaps perhaps additionally trot and tumble local samples in the browser editor

  • mighty error going through: error reported in console, musique non-quit!

  • combine JavaScript code to originate visuals with Hydra synth made by @ojack

  • what you scrutinize is what you salvage: no want to rob anything, factual commerce the code and change, Glicol engine will say LCS algorithm to address adding, updating and taking out

  • decentralised collaboration using yjs and a queer be-ready mechanism

As a web audio library

The js folder contains the Glicol distribution for the catch platform.

The utilization is amazingly easy. Obliging consist of this into your index.html:


Then you definately can write in your online page:

It appears, one of these protocol would be precious for apps like a drum machine.

Explain that it’s well-known to tranquil allow immoral-origin-isolation in your server.

See js folder for diminutive print.

As a Rust audio library

Glicol synth remains to be beneath pattern, mainly on the clinical doctors, and will seemingly be printed to crates.io soon.

For now, you might perhaps perhaps perhaps fork and download this repo.

A survey of the syntax of glicol_synth:

say glicol_synth::{AudioContextBuilder, price::ConstSig, Message};

fn valuable() {
    let mut context=AudioContextBuilder::::original()
    .sr(44100).channels(1).kind();

    let node_a=context.add_mono_node(ConstSig::original(42.));
    context.connect(node_a, context.destination);
    println!("first block {:?}", context.next_block());

    context.send_msg(node_a, Message::SetToNumber(0, 100.) );
    println!("second block, after msg {:?}", context.next_block());
}

See rs folder for diminutive print.

Roadmap

  • 0.1.0 hi there world from dasp_graph and pest.rs, cross code from js to wasm, and slothful evaluate
  • 0.2.0 cross samples from js to wasm, make stronger error going through, bpm regulate in console
  • 0.3.0 kind complex node plate reverb using fashioned node from glicol, using macro in Rust
  • 0.4.0 say LCS algorithm and preprocessor for tender and atmosphere qualified complete graph updating
  • 0.5.0 kind const_generics to dasp_graph and say it in glicol, say SharedArrayBuffer, make stronger local sample loading
  • 0.6.0 refactor the code to modules:
    • glicol-valuable=glicol-synth + glicol-parser + glicol-ext
    • glicol-ext=glicol-synth + glicol-parser + glicol-macro
    • glicol-js=glicol-valuable + glicol-wasm
  • 0.7.0 make stronger mixing js with glicol in glicol-js using Regex; add visualisation
  • 0.8.0 embed Rhai in glicol 🎉
  • 0.9.0 redesigned structure; scrutinize the originate display disguise
  • 0.10.0 scamper as a VST plugin
  • 0.11.0 scamper on Bela
  • better mu

Read More
Portion this on knowasiak.com to hunt the recommendation of with of us on this topicTrace in on Knowasiak.com now even as you furthermore mght can very neatly be no longer registered yet.

Charlie Layers
WRITTEN BY

Charlie Layers

Fill your life with experiences so you always have a great story to tellBio: About: