ADR 0001 — Architecture and toolchain
Status: accepted (2026-11-24).
Context (measured on the build machine)
MacBook Pro, Apple M5 Max (18 cores), 48 GB, macOS 27.0 (26A5425a), Xcode 27.2 (27B52),
Swift 6.4.2, Rust 1.95.0 (aarch64-apple-darwin only), XcodeGen, create-dmg, ffmpeg/ffprobe,
afinfo/afconvert. Signing identity present: Developer ID Application: Simon-Pierre Boucher (3YM54G49SN); notarytool keychain profile used by the other ORIX apps: MacLustr-Notarize.
No previous Sonata repository existed.
Decision
- Rust for everything that defines the meaning of a program: lexer, parser, semantics,
compiler, DSP, instruments, runtime, renderer, interchange, CLI, LSP. One staticlib
(
sonata-ffi) exposes a C ABI. - Swift 6 / SwiftUI + AppKit for the app; TextKit 2 editor; AVAudioEngine
(
AVAudioSourceNode) pulls audio from the RustProcessorin the render callback; Core Graphics first for visualisations, Metal where measurement justifies it (spectrogram, 3D waterfall). Metal never runs in the audio callback. - The Swift side holds no musical logic: timing, parameters, diagnostics and graph come from the Rust crates (JSON across the ABI for cold data; plain C structs and ring buffers for hot data).
- arm64 only for 0.1. universal2 is not attempted: no Intel machine is available to test on.
- macOS deployment target 15.0, like the other ORIX apps; verified only on macOS 27.
- Vectorisation: the DSP is written as tight scalar loops that LLVM auto-vectorises (NEON). Accelerate/vDSP is used on the Swift side for display-only analysis if profiling asks for it; the Rust FFT is the reference implementation so the CLI and the app agree.
- Dependencies: serde + serde_json only in the product crates; anything else is a recorded
exception in
Documentation/DEPENDENCIES.md. - The compiled artefact for 0.1 is an execution plan interpreted by the runtime (prepared graph + event lists). No machine code is generated and none is claimed.
Consequences
- The engine is testable headless (
cargo test,sonataCLI) and the studio cannot diverge from the compiler. - A Rust toolchain is required to build the app;
Scripts/build.shbuilds the staticlib first. - Real-time and offline rendering run the same
Processor, so parity is by construction.