Skip to main content

songbird-export

Offline audio rendering — master export, stem export, and track bounce. This crate renders audio from the engine graph to WAV files without real-time constraints. It processes the entire timeline (or a time range) as fast as possible, writing the result to disk.

Module Map

songbird-export/src/
├── lib.rs      — Public API (ExportConfig, StemConfig, export_master, export_stems)
├── render.rs   — Offline render loop (advances transport, processes graph, writes samples)
└── bounce.rs   — Track bounce (render-in-place for a single track)

Export Modes

Master Export

Renders the full mix to a single stereo WAV file:
let config = ExportConfig {
    output_path: "/path/to/output.wav".into(),
    sample_rate: 44100,
    bit_depth: 24,
    start_seconds: 0.0,
    end_seconds: 120.0,
    normalize: true,
};
let result = export_master(&graph, &transport, &clip_scheduler, &config);

Stem Export

Renders each track individually with solo isolation:
let stem_config = StemConfig {
    output_dir: "/path/to/stems/".into(),
    tracks: vec![0, 1, 2, 3],  // Track indices to export
};
let results = export_all_stems(&graph, &transport, &clip_scheduler, &config, &stem_config);

Track Bounce

Renders a single track in-place, replacing its clips with a single audio clip:
let result = bounce_track(&graph, &transport, &clip_scheduler, track_index, &config);

Rendering Pipeline

ExportConfig
  → Create offline Transport (non-realtime)
  → Loop: advance transport by block_size samples
    → ClipScheduler resolves active clips
    → AudioGraph.process() renders one block
    → Accumulate output samples
  → Normalize if requested (peak or LUFS)
  → Write WAV file via hound
  → Return ExportResult { path, duration, peak_level, ... }

Testing

cargo test -p songbird-export