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§
- A synthesis request, which can be processed to multiple output types.
- A SoundFont
Composition
synthesizer (.sf2
specifically). Outputs as WAV format. - Reperesents a SoundFont.
- Options to configure a
SF2Synthesizer
.
Traits§
- Trait implemented for types which can provide midi file bytes. (
Composition
,Smf
..) - A trait implemented by types which can be synthesized.
Type Aliases§
- Result type which may produce
SynthesisError
.