pub struct SampleSoundfont { /* private fields */ }Expand description
Represents a sample soundfont to be used within XSynth.
Supports SFZ and SF2 soundfonts.
§SFZ specification support (opcodes)
lovel&hivellokey&hikeypitch_keycentervolumepansampledefault_pathloop_modeloop_startloop_endoffsetcutoffresonancefil_veltrackfil_keycenterfil_keytrackfilter_typetuneampeg_startampeg_delayampeg_attackampeg_holdampeg_decayampeg_sustainampeg_release
§SF2 specification support
§Generators
startAddrsOffsetendAddrsOffsetstartloopAddrsOffsetendloopAddrsOffsetstartAddrsCoarseOffsetendAddrsCoarseOffsetstartloopAddrsCoarseOffsetendloopAddrsCoarseOffsetinitialFilterFcinitialFilterQpandelayVolEnvattackVolEnvholdVolEnvdecayVolEnvsustainVolEnvreleaseVolEnvinstrumentkeyRangevelRangeinitialAttenuationcoarseTunefineTunesampleIDsampleModesoverridingRootKeyscaleTuningexclusiveClasskeynumvelocitykeynumToVolEnvHoldkeynumToVolEnvDecay
§Modulators
XSynth intentionally supports a baked subset of SF2 modulators so note-on articulation can be resolved at soundfont load time without adding runtime voice stages. Currently supported:
- sources: key number and note-on velocity
- curves: linear, concave, convex, and switch
- transforms: linear and absolute
- destinations: attenuation, filter cutoff, pan, volume envelope timings, and static pitch offsets
The following SF2 features are intentionally not supported in the runtime engine because they would add significant hot-path and binary-size cost:
- modulation envelope generators and destinations
- modulation LFO / vibrato LFO generators and destinations
- generic CC / aftertouch / pitch-wheel-driven SF2 modulators
- chorus and reverb send behavior
Implementations§
Source§impl SampleSoundfont
impl SampleSoundfont
Sourcepub fn new(
path: impl Into<PathBuf>,
stream_params: AudioStreamParams,
options: SoundfontInitOptions,
) -> Result<Self, LoadSfError>
pub fn new( path: impl Into<PathBuf>, stream_params: AudioStreamParams, options: SoundfontInitOptions, ) -> Result<Self, LoadSfError>
Loads a new sample soundfont of an unspecified type. The type of the soundfont will be determined from the file extension.
Parameters:
path: The path of the soundfont to be loaded.stream_params: Parameters of the output audio. See theAudioStreamParamsdocumentation for the available options.options: The soundfont configuration. See theSoundfontInitOptionsdocumentation for the available options.
Sourcepub fn new_sfz(
sfz_path: impl Into<PathBuf>,
stream_params: AudioStreamParams,
options: SoundfontInitOptions,
) -> Result<Self, LoadSfzError>
pub fn new_sfz( sfz_path: impl Into<PathBuf>, stream_params: AudioStreamParams, options: SoundfontInitOptions, ) -> Result<Self, LoadSfzError>
Loads a new SFZ soundfont
Parameters:
path: The path of the SFZ soundfont to be loaded.stream_params: Parameters of the output audio. See theAudioStreamParamsdocumentation for the available options.options: The soundfont configuration. See theSoundfontInitOptionsdocumentation for the available options.
Sourcepub fn new_sf2(
sf2_path: impl Into<PathBuf>,
stream_params: AudioStreamParams,
options: SoundfontInitOptions,
) -> Result<Self, Sf2ParseError>
pub fn new_sf2( sf2_path: impl Into<PathBuf>, stream_params: AudioStreamParams, options: SoundfontInitOptions, ) -> Result<Self, Sf2ParseError>
Loads a new SF2 soundfont
Parameters:
path: The path of the SF2 soundfont to be loaded.stream_params: Parameters of the output audio. See theAudioStreamParamsdocumentation for the available options.options: The soundfont configuration. See theSoundfontInitOptionsdocumentation for the available options.
Trait Implementations§
Source§impl Debug for SampleSoundfont
impl Debug for SampleSoundfont
Source§impl SoundfontBase for SampleSoundfont
impl SoundfontBase for SampleSoundfont
fn stream_params(&self) -> &AudioStreamParams
fn get_attack_voice_spawners_at( &self, bank: u8, preset: u8, key: u8, vel: u8, ) -> Vec<Box<dyn VoiceSpawner>>
fn get_release_voice_spawners_at( &self, _bank: u8, _preset: u8, _key: u8, _vel: u8, ) -> Vec<Box<dyn VoiceSpawner>>
Auto Trait Implementations§
impl Freeze for SampleSoundfont
impl RefUnwindSafe for SampleSoundfont
impl Send for SampleSoundfont
impl Sync for SampleSoundfont
impl Unpin for SampleSoundfont
impl UnsafeUnpin for SampleSoundfont
impl UnwindSafe for SampleSoundfont
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more