Grimoire DAW engine illustration

Grimoire

The assembled DAW engine, with a headless JSON-RPC protocol any UI can drive.

Grimoire is the component that wires the other components into one complete, headless audio engine. It is part of Signals & Sorcery, a coherent set of Rust audio building blocks for audio apps, plugins, players and DAWs.

Repositorygithub.com/shiehn/grimoire-daw-engine
LicenseMIT, free for commercial and closed-source use
StatusPlanned
LayerThe engine (how the layers stack)
Crates (planned names)grimoire

What it is

Each component is useful alone. Grimoire is for people who want the whole thing: an engine they can start, point at a project, and drive from any language.

  • Threads and lifecycles. A control thread, a writer thread for the project store, the audio callback and background workers, each with written rules about what it may do.
  • Projects. Open, edit, save and close Tapestry projects. Every edit goes through an intent, so undo and replay always work.
  • Playback. One or more transports, each running a Procession playback into a Leyline graph on an Aethergate device.
  • Plugins. Plugin chains through a PluginHost trait, with Summoner as the default implementation, so a crashing plugin never takes the engine down.
  • Import, render, bounce and freeze. Media import through Scriptorium, offline render on the same graph as live playback, and track freezing as a mechanism an application applies with its own policy.
  • Recording. Takes captured through Aethergate and written crash-safe through Scriptorium.
  • The protocol. Newline-delimited JSON-RPC 2.0 over TCP and local sockets, with events, limits and a JSON Schema for every method. Method groups cover projects, intents, transport, tracks, clips, plugins, render and audio.
  • Method modules. Applications register their own namespaces of methods beside the built-in ones, so product features live in the application, not in the engine.

Usage example

Illustrative sketch

Planned, not final. Taken from the READMEopen in new window.

As a library:

use grimoire::{Engine, EngineConfig};

let mut engine = Engine::start(EngineConfig::default())?;
let project = engine.open("MySong.project")?;
engine.transport(0).play()?;

// Serve the protocol so a UI in another process can drive it.
engine.serve("127.0.0.1:0")?;

Over the protocol, from anything that can open a socket:

{"jsonrpc":"2.0","id":1,"method":"project.open","params":{"path":"MySong.project"}}
{"jsonrpc":"2.0","id":2,"method":"intent.apply","params":{"name":"track.insert","params":{"kind":"audio","name":"Vox"}}}
{"jsonrpc":"2.0","id":3,"method":"transport.play","params":{"transport":0}}
{"jsonrpc":"2.0","method":"event.transport","params":{"transport":0,"playing":true}}

A typed TypeScript client generated from the schemas is part of the plan, so web and Electron user interfaces get autocompletion and checked calls.

How it fits in the ecosystem

Grimoire is the engine row. Dependencies point down, never up.

Below it: every other engine component, each reached through its published interface, so any one can be replaced with your own:

Above it: only applications, Familiar (repoopen in new window) extensions, and user interfaces built with Glyphwork (repoopen in new window).

Headless first. Everything a user interface can do, the protocol can do. Scripts, tests, command-line tools and automated agents are first-class clients.

What it deliberately doesn't do: no user interface, no product logic (that lives in applications, as method modules and app data), and no lock-in. An application that only needs a graph and a device should use Leyline and Aethergate directly.

Extend and display
The engine
Musical structure
Signal flow
ComponentRepositoryRoleStatus
Runecraftrunecraft-audio-coreShared contracts, realtime safety, process isolation and realtime-safe logging: the floor every other component stands onIn preparation
Orreryorrery-musical-timeTempo and meter, transports, bar, beat and sample maths, timed MIDIIn preparation
Summonersummoner-plugin-hostOut-of-process VST3 and Audio Unit plugin hosting with crash isolationIn preparation
Aethergateaethergate-audio-platformAudio devices (cpal, CoreAudio, a fake device for tests) and shared-memory metersPlanned
Leylineleyline-audio-graphA realtime audio graph with delay compensation, and a compiler from an edit model to a graphPlanned
Cantripscantrips-audio-dspBuilt-in mixer DSP: sampler, fader, pan, meters, compressorPlanned
Scriptoriumscriptorium-audio-mediaDecode and encode, a sample store, streaming voices, crash-safe recordingPlanned
Tapestrytapestry-session-modelTracks, clips, lanes and scenes; edits with undo; a crash-safe project storePlanned
Processionprocession-timeline-engineWhat plays in each block: regions, notes, automation, launchesPlanned
Grimoiregrimoire-daw-engineThe assembled engine and its headless JSON-RPC protocolPlanned
Familiarfamiliar-plugin-sdkAn SDK for plugins and panels that extend a Signals & Sorcery enginePlanned
Glyphworkglyphwork-audio-uiAudio UI widgets: meters, knobs, faders, waveformsPlanned

Status

Planned. No code yet. The repositoryopen in new window holds the design.

macOS first, then Windows and Linux as the components below support them. Driving a native engine from a browser through the protocol works anywhere; running the engine itself in WebAssembly is a later exploration.

Last Updated:
Contributors: shiehn