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
Error types which may occur during synthesis.

Structs§

SF2SynthesisRequest
A synthesis request, which can be processed to multiple output types.
SF2Synthesizer
A SoundFont Composition synthesizer (.sf2 specifically). Outputs as WAV format.
SoundFont
Reperesents a SoundFont.
SoundFontSynthesizerOptions
Options to configure a SF2Synthesizer.

Traits§

MidiBytesProvider
Trait implemented for types which can provide midi file bytes. (Composition, Smf..)
SF2Synthesizable
A trait implemented by types which can be synthesized.

Type Aliases§

Result
Result type which may produce SynthesisError.