Reimagination of SC architecture using Python and gccjit

Hi.

I’ve been playing with an idea of mine which recently reached a usable state.

What is SuperCollider had not invented a new language and would have
used JIT compilation to lower SynthDefs to actual machine code?

I have:

  • Graph functions in Python.
  • A SynthDef binary format similar to what SC uses.
  • SynthDefs are compiled to machine code using gccjit.
  • Logical time scheduling using Python generators, yielding time.
  • A minimal Event system.
  • A REPL and script/score execution.

$ uv sync
$ uv run python -m mc1

clock.schedule(default_event(midi_note=55).play(dsp))
@DAG
… def tone(freq=440, amp=0.2):
… env = ADSR(0.01, 0.5, 0.2, 0.5, 1) * amp
… Out.ar(0, Pan(SinOsc.ar(freq) * env))
dsp.compile(tone)
await clock.schedule(default_event(instrument=“tone”).play())

$ uv run python -m mc1 examples/joy.py

It is far from end-user ready, still a PoC.
But I figured people here might be interested to at least take a look.

Roughly 5k LOC and it plays the iconic SICP title melody :slight_smile:

Enjoy

1 Like