SPB Git

Repository Public

exports.md 4.5 KB

# Exports

# Audio

Composition › Render to Audio File… (⌘E) in the app, sonata render on the command line. Both use the offline renderer, which runs the same engine as playback: what you export is what you heard, and rendering the same piece twice gives identical files.

Choice Options Notes
Format WAV, AIFF, FLAC FLAC is lossless and about half the size
Sample size 16, 24 or 32-bit integers; 32-bit float (WAV, AIFF) FLAC stores 16 or 24 bits
Sample rate 44.1, 48, 88.2, 96, 176.4, 192 kHz the project's rate unless you choose another; the piece is rendered at that rate, not converted afterwards
Tails on / off on: the render continues until releases and reverbs have died away (below −90 dBFS), for at most 30 s
Dither on / off on: TPDF dither is added when reducing to 16 or 24 bits, and only then
Normalise off / peak / loudness off by default
Stems on / off one extra file per track and bus

Nothing is normalised unless you ask. With Normalise off, the file has exactly the level the code and the mixer give it. Peak scales the whole render so that its true peak reaches the target (−1 dBTP unless you set one); Loudness scales it to a target integrated loudness (−16 LUFS unless you set one) without letting the true peak exceed −1 dBTP. The same gain is applied to the stems.

After a render, the app and the command line report what was measured in each file: duration, sample peak, true peak and integrated loudness.

# Stems

Stems are written beside the main file as name - track.ext. They have the same length and start, so they line up when imported into another program. A stem is the track (or bus) after its effects, fader and pan — what it contributes to the master. Stems sum to the master only when the master has no effect, a gain of 0 dB and no limiter.

# For measurements

For a render that must be exactly the signal, with nothing protective in the way:

sonata
composition "Test Tone" {
    instrument tone: FluteOrgan {
        gain -12dB
        play A4 duration 1/1
    }
    master {
        peak_limit off
    }
}
text
sonata render tone.sonata --output tone.wav --float --no-dither --no-tail

# Checking a file

The files were verified with independent decoders (afinfo, ffprobe, ffmpeg): every combination of format and sample size decodes to the rendered samples within half a least-significant bit, exactly for float. You can check your own:

text
afinfo piece.wav
ffprobe -v error -show_entries stream=codec_name,sample_rate,channels,duration piece.flac

AAC and MP3 are not written by this version.

# MIDI

Composition › Export MIDI… or sonata export piece.sonata --output piece.mid writes a Standard MIDI File (format 1, 960 ticks per quarter note).

  • The first track carries the title, the tempo map, the time signatures, the key and the markers. Each instrument track becomes a MIDI track.
  • Positions are rounded to the nearest tick. A tempo ramp becomes one tempo event per sixteenth note.
  • Drum engines (kick, snare, hihat) go to channel 10 with General MIDI keys.
  • A MIDI file has no microtones: fractional pitches are rounded to the nearest semitone, and the export tells you how many notes were affected.
  • Audio tracks are not part of a MIDI file.

# MusicXML

Composition › Export MusicXML… or sonata export piece.sonata --output piece.musicxml writes MusicXML 4.0 for notation programs: parts, measures, voices, ties across bar lines, dotted values, triplets, quintuplets and septuplets, key and time signatures, tempo marks and articulations.

It is a faithful transcription of what the code says, not engraving. Limits you should know:

  • Durations that cannot be written with dots and simple tuplets are quantised to a 128th-note grid, and the export says so.
  • More than four simultaneous voices on one track cannot be written on one staff; extra chords are left out and reported.
  • Microtones are written as fractional alterations.

The Score space (Score) draws the same notation and exports it as PDF.

# Importing

  • MIDI. sonata import song.mid --output song.sonata turns a MIDI file into Sonata source that you can then edit like any other.
  • Audio. WAV, AIFF and FLAC files placed in a project's assets folder are played by audio tracks (Modules and projects).
Files main
Menu

Theme