Tapestry session model illustration

Tapestry

The multi-track session model: tracks, clips, lanes and scenes, edits with undo, a crash-safe project store.

Tapestry is the component that holds what a project is and how it changes. It is part of Signals & Sorcery, a coherent set of Rust audio building blocks for audio apps, plugins, players and DAWs.

Repositorygithub.com/shiehn/tapestry-session-model
LicenseMIT, free for commercial and closed-source use
StatusPlanned
LayerMusical structure (how the layers stack)
Crates (planned names)tapestry

What it is

Every DAW has a document: tracks in folders, clips on a timeline, automation, a tempo map, plugin chains, maybe a grid of launchable clips. Every DAW also needs undo that never lies, and a project folder that survives a crash in the middle of a save. Tapestry is those three things as one generic model.

The model. Tracks and folders with sends; MIDI and audio clips of one clip type used on a timeline lane and in a launcher slot; take lanes and comping in the design; scenes and launch groups; an optional section layer (intro, verse, chorus); automation lanes with curves; tempo, meter and key maps in Orrery's types; plugin chains as data; and app data on every entity: namespaced, size-capped, opaque values an application attaches without forking the model. One model aims to describe a linear timeline DAW, a session and arrangement DAW with a clip launcher, and shapes nobody has built yet.

Edits with inverses. Every change is an intent: a typed edit that returns the new document and its inverse. Intents go to an append-only log, which gives linear undo and redo, replay of a whole session, and an inverse self-check (apply, invert, compare) that tests run over every intent. Applications register their own intents and get undo and replay for free.

The project store. A project is a folder: canonical JSON for the document, content-addressed blob stores (audio, plugin state, renders), append-only logs and a manifest. Saving uses a two-step commit with file-system barriers, so a crash at any moment leaves the old project or the new one, never a mix. Opening verifies what it reads, unused blobs are collected, and a lock stops two processes writing one project.

Usage example

Illustrative sketch

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

use tapestry::{Project, Store, intents::*};

let mut store = Store::create("MySong.project", StoreSpec::default())?;
let mut doc = store.open_document()?;

let drums = doc.apply(TrackInsert::audio("Drums"))?;
let clip = doc.apply(ClipPlace::new(drums, media_ref, Bars(1)..Bars(9)))?;
doc.apply(AutomationAdd::volume(drums).point(Bars(8), -12.0))?;

doc.undo()?;                       // the automation point is gone
doc.redo()?;                       // and back
store.commit(&doc)?;               // crash-safe save

// An application's own intent, with undo and replay for free:
doc.registry_mut().register::<MyApp::SetMood>();

How it fits in the ecosystem

Tapestry is in the musical structure row, beside Procession. Dependencies point down, never up.

Below it: Orrery (repoopen in new window) for time types and Runecraft (repoopen in new window) for its floor. It produces the mixer description that Leyline (repoopen in new window)'s compiler turns into a graph, and refers to media in Scriptorium (repoopen in new window) by content.

Beside it: Procession (repoopen in new window). The two don't depend on each other.

Above it:

What it deliberately doesn't do: no playback (it describes; Procession and Leyline play), no user interface (editors emit intents), no collaborative merging (it is a linear log, not a CRDT), and no interchange format yet.

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.

Pure Rust over the file system: macOS, Windows and Linux. A WebAssembly build that edits projects in a browser is a later exploration.

Last Updated:
Contributors: shiehn