Projects / 08
odawg
A music engine for Odin. A song is data: sections, a style, an energy and chords. odawg composes it on synths, circuit-modelled drum machines and sampled instruments, routes it through buses and returns, plays it in real time from anywhere, and masters it.
- Odin
- MIT
- Sampled CC0 sets
- 808 · 909 · 303
- Buses · returns · sidechains
- 48 kHz · EBU R128
Hear it
Six songs, each from a spec, rendered and mastered by odawg alone. The first four are a few lines each and synthesized, every sound; the fifth plays sampled instruments, fetched the first time it was rendered; the sixth is a pop production written out part by part, routed through buses and a sidechain. The whole of the first one is under Use it.
01Booty house134 BPM · 808
The 808 model plays the kit and, tuned, the sub in short stabs under the kick; an FMSynth chants through an echo.
From
examples/booty_house.json02Chicago house124 BPM · 909
A 909 four on the floor with swung hats and a jackin' rim, a rolling bass, organ stabs on the off-beats, piano at the peak.
From
examples/chicago_house.json03Acid house125 BPM · 303 · 909
Two 303-style lines squelching on accents and gliding on slides, over a 909 groove.
From
examples/acid_house.json04One song, three styles84 → 124 → 70 BPM
A lo-fi intro to talk over, a two-bar ramp from 84 to 124 BPM into a house drop, a lighter explanation, an ambient outro.
From
examples/explainer.json (WORKFLOWS.md W1)05Lo-fi, played on samples78 BPM · sampled
The lofi style on recorded instruments: a soft grand, a fingered jazz bass, a jazz kit through a stereo mic, and string sections in the second half.
From
examples/lofi_live.jsonSamples, all CC0: Osiris Piano, Virtuosity Drums and VS Chamber Orchestra 2 by Versilian Studios (the first two with Karoryfer Samples), Growlybass by Karoryfer Samples.
06Pop, produced116 BPM · A minor
Every part written out: an 808 glued on a drum bus, a sub and a bass ducked by the kick, an upright piano through the verses, supersaw chords pumping under the drums' sound, a hook through a dotted-eighth echo, strings under the last chorus.
From
examples/pop.jsonSamples, CC0: the upright piano from the Versilian Community Sample Library, strings from VS Chamber Orchestra 2 by Versilian Studios.
48 kHz renders by odawg v0.0.42's render --master web, here as Opus at 150 kbit/s (MP3 where Opus doesn't play).
By the numbers
- faster than real time
- 41–135×
- the 58 s explainer, composed, rendered and mastered, in 0.43 s; booty house's 45 s in 0.37 s; acid house's 52 s in 1.3 s
- samples differ by block size
- 0
- a song streamed in 800-sample blocks, one 60 fps frame each, against the same song in one go
- LUFS, mastered for streaming
- -14
- all six demos at -14.1 to -14.2 LUFS and -1.2 to -1.8 dBTP as served, Opus and MP3; podcast and broadcast (EBU R128) targets too
- styles, written as data
- 7
- ambient, house, lofi, synthwave, chicago_house, booty_house and acid_house, example files a song names by path; write your own the same way
Speed from odawg v0.0.42's render --master web (built -o:speed) on the four synthesized demos (2026-10-26, Ryzen 9 9900X3D, 24 threads, timed end to end, median of 3 after a discarded first run, mastering's measuring passes included); loudness and true peak (EBU R128) on all six files served here. The block test is test_blocks in render/render_test.odin, passing on v0.0.42; the styles are examples/styles/*.json.
What's in it
01Songs and styles as data
Sections with a tempo or a ramp, a meter, a style, an energy and chords; parts that play step strings, sequences, chord degrees, arpeggios and chords. A style is a file: its parts and what each plays at each energy. Seven come as examples (examples/styles/*.json) to name by path or copy; a song can bring its own.
02Real instruments, sampled
A Sampler plays CC0 sample sets (pianos, string sections, a bass, a jazz kit) from VCSL, VSCO 2, Karoryfer and others, each in a licence register with every file pinned by SHA-256. A set downloads the first time a song plays it, only the notes the song reaches load (every core decoding), and each plays at a synth preset's level.
03An 808, a 909 and a 303, from their circuits
DrumMachine models the TR-808's and TR-909's circuits: bridged-T resonators, six square oscillators for the metal, the clap's bursts, and no two hits quite alike. AcidSynth is a TB-303-style voice: a diode-ladder squelch, accents that build on each other, slides that glide.
04Routing like a mixing desk
A song is a graph: tracks into parts, parts into buses with their own effects, sends into shared returns (one reverb, however many send to it), a compressor keyed by another part's sound for the pump under the kick. Paths with lookahead line up where they meet, a return sleeps when nothing feeds it, and a loop is a finding, not a crash.
05Real time, exact, on every core
The engine plays any block from anywhere, and the samples never depend on the block size; an exact seek chases the notes still sounding and runs each effect's tail in. An export is that stream in time segments across every core: the same spec and seed give the same samples.
06Mastered and measured
A mastering target (streaming at -14 LUFS, podcast, broadcast) sets the loudness and a lookahead limiter holds true peaks at -1 dBTP; web is streaming's loudness under -2 dBTP, room for an Opus or MP3 encode's overshoot. Loudness, true peak and loudness range are measured as EBU R128 says. odawg inspect renders a song and reports peaks, clipping, silent parts and loudness.
07In Tone.js's vocabulary
What someone who knows Tone.js reaches for is there: Synth, MonoSynth, FMSynth, AMSynth, MembraneSynth, MetalSynth, NoiseSynth and PluckSynth with Tone's options; reverb, delays, chorus, filters, distortion; notes as "C4", time as "8n.", "2m" or "2:1:0", tempo ramps as rampTo makes them. The names are Tone's; the engine is odawg's.
08Questions a picture can follow
Where a section starts and how far through it a moment is, a pulse from the real kicks rather than from onsets, the time of every clap. onimite's song{} and sound{} are odawg: its videos' music and sound effects, cut to the picture.
09Data-oriented
Layers as packages, each importing only those above it. Every instrument, effect, play pattern, check, mastering target and command is a table row naming its procs, the routing is two tables, and every note of a song is one flat table. An edit is a command row ("make the kick louder" is one), and what is measured of a song has rows only where it sounds.
Not yet
- No GUI: songs are specs, in JSON or a host's tables, and the command line shows and checks them.
- No plugin hosting.
Use it
{
"name": "booty", "key": "G minor", "seed": 5,
"sections": [
{ "name": "intro", "duration": "4m", "bpm": 134, "style": "styles/booty_house.json", "energy": 0.5, "chords": "Gm Gm Eb F" },
{ "name": "jack", "duration": "8m", "energy": 0.9 },
{ "name": "break", "duration": "2m", "energy": 0.3 },
{ "name": "peak", "duration": "8m", "energy": 1 }
]
}{
"name": "score",
"description": "WORKFLOWS.md W1: a lo-fi intro under narration, a ramp into a house drop, a lighter explanation, an ambient outro.",
"instruments": "instruments/classic.json",
"key": "A minor", "seed": 7,
"sections": [
{ "name": "intro", "duration": 9.5, "bpm": 84, "style": "styles/lofi.json", "energy": 0.3, "chords": "Am7 Fmaj7 C G" },
{ "name": "build", "duration": "2m", "bpm": [84, 124] },
{ "name": "drop", "duration": "8m", "flex": ["4m", "8m"], "bpm": 124, "style": "styles/house.json", "energy": 1, "chords": "Am F C G" },
{ "name": "explain", "duration": 8.2, "energy": 0.5 },
{ "name": "outro", "duration": 6, "bpm": 70, "style": "styles/ambient.json", "chords": "Fmaj7 Am7" }
],
"parts": {
"lead": { "role": "melody", "instrument": "pluck", "octave": 5, "gain_db": -9.1, "room_db": -6,
"play": [ { "name": "drop@4m..", "notes": "E5 G5 A5 - G5 E5 D5 -", "subdivision": "8n" } ] }
},
"markers": [ { "name": "logo", "at": "drop@2m" } ]
}make build # build/odawg
build/odawg render examples/booty_house.json -o booty.wav --master streaming
build/odawg render examples/explainer.json -o score.wav --master streaming --stems stems
build/odawg timeline examples/explainer.json # the form, the tracks, the findings
build/odawg at examples/explainer.json drop@1m # the section and bar, the chord, the notes sounding
build/odawg show examples/acid_house.json parts/acid # a part's notes and its instrument's controls
build/odawg show instrument/MonoSynth # a built-in row, to copy
build/odawg inspect examples/explainer.json # peaks, clipping, silent parts, loudnessimport "deps:odawg/base" // with -collection:deps=.. from a sibling project
import "deps:odawg/render"
import "deps:odawg/song"
import "deps:odawg/spec"
findings := make(base.Findings)
sp: spec.Spec
spec.spec_from_json(text, &sp, &findings) // or a host's own tables, through the same reader
s: song.Song
song.song_from_spec(&sp, &s) // the form, the arrangement, every note
// an export: time segments on every core, mastered to -14 LUFS and
// -1 dBTP, streamed to a sink a segment at a time (here a WAV being written)
w: render.Wav_Writer
render.wav_open(&w, "booty.wav")
loud := render.master_export(&s, {}, .Streaming, {&w, proc(data: rawptr, at: i64, l, r: []f32, _: [][2][]f32) {
render.wav_push((^render.Wav_Writer)(data), l, r)
}})
render.wav_close(&w)
// or a stream from anywhere: any block size, the same samples
e: render.Engine
render.engine_init(&e, &s)
render.engine_process(&e, left[:800], right[:800]) // one 60 fps frame at 48 kHz
// questions a picture can follow
at, _ := song.seconds_from_position(&s, "peak@1m") // seconds
kick := song.pulse_from_seconds(&s, at, {part = "drums", note = "kick"}, 8) // 1 on each real kickThe family
- ocurves
Curve geometry: exact pixel coverage, and booleans that keep their curves
- ovg
2D vector graphics: paths, SVG, Lottie, text, filters
- oglyph
Fonts and OpenType text shaping, checked against HarfBuzz
- oicut
Video, audio and image codecs with no FFmpeg
- oksl
SkSL and Shadertoy shaders to SPIR-V, MSL and CPU
- o3d
3D in three.js terms, on the GPU or the CPU
- ottis
Text to speech with a time for every word
- odawg
Music from songs as data: synths, sampled instruments, an 808, a 909 and a 303, mixed and mastered
- onimite
Videos from Lua scripts, written by you or your coding agent