Crate redact_composer_synthesis

source ·
Expand description

Audio synthesis utilities.

§Example

Synthesize a Composition to WAV format using SF2Synthesizer.

let composition: Composition = todo!();
let synth = SF2Synthesizer::new("./path/to/sound_font.sf2")
    .expect("The SoundFont file should exist and be SF2 format");
synth.synthesize(&composition)
    .to_file("./path/to/output.wav")
    .unwrap();

// Alternatively
composition.synthesize_with(&synth)
    .to_file("./path/to/output.wav")
.unwrap();

§Options

SF2Synthesizer defaults to 44.1kHz sample rate with a bit-depth of 16, but can be customized if desired.

let synth = SF2Synthesizer::new_with_options(
    "./path/to/sound_font.sf2",
    SoundFontSynthesizerOptions {
        sample_rate: 96000,
        bit_depth: 32, // This should be one of [8, 16, 24, 32].
    }
).expect("Custom settings should be applied!");

Modules§

  • Error types which may occur during synthesis.

Structs§

Traits§

Type Aliases§