SPB Git

Repository Public

project-format.md 2.9 KB

# The .sonataproject format (format 2)

A project is a directory (a macOS package) holding user data only. Implementation: Packages/SonataProject; tests: round trip, migration from format 1, path safety, missing files.

text
Name.sonataproject/
  project.json     manifest: format, id (UUID), name, languageVersion, main, created, modified, assets[], writtenBy
  studio.json      studio state: overrides (strips, notes), loop range, metronome, track colours and heights
  src/*.sonata     sources; `main` designates the entry (default src/main.sonata)
  instruments/*.sonatainstrument   instrument definitions saved from Instrument Lab (Sonata source)
  assets/          imported audio, content-addressed names (first 16 hex digits of the SHA-256 + extension)

Outside the bundle, per project id:

What Where Regenerable
Waveform overviews, frozen bounces, compile cache ~/Library/Caches/ai.spboucher.orix.sonata/projects/<id>/ yes — safe to delete
Backups of the sources before each save (20 kept) ~/Library/Application Support/ORIX Sonata/Backups/<id>/ no
Unsaved edits (crash recovery) the system's document autosave (~/Library/Autosave Information/ for untitled documents, in place for saved ones) managed by macOS

# Rules

  • The code is canonical. studio.json holds explicit overrides in the exact schema of sonata_ir::Overrides; the compiler applies them after compilation. Each note override carries the start and pitch of the note it edited: if the code changed that note, the override is reported as a conflict and skipped — never applied to a different note, never written back into the source silently. Deleting studio.json returns the project to exactly what the code says.
  • Paths in the manifest are relative, inside src/, instruments/ or assets/; no .., no absolute path, no backslash or control character; a file that resolves outside the bundle through a symlink is skipped with a warning.
  • Writes are atomic per file (temporary file + rename); the manifest is written last; a new bundle is assembled in a temporary directory and moved into place in one step. assets/ and files the format does not know are never modified or removed.
  • Missing assets and an unreadable studio.json do not prevent opening: they are listed to the user.
  • A manifest with a newer format than the application is refused with a clear message; older formats are migrated in memory and rewritten on the next save.
  • No secret is ever stored in a project. API keys of the optional assistant live in the Keychain.
  • Limits: 4 MiB per source file, 2 GiB per asset.

# Format history

Format Change
1 development format: entry instead of main, no assets, dates as seconds since 1970
2 current
Files main
Menu

Theme