Expand description
A bounded, provider-neutral boundary between acorde playback events and a
SoundFont renderer.
This crate validates SF2/SF3 metadata and produces lifecycle actions. It intentionally does not decode samples or ship a synthesizer; applications choose a licensed renderer on the other side of this stable boundary.
Structs§
- Decoded
Sample - Validated PCM returned by a separately licensed decoder.
- Decoded
Sample Region - PCM decoded for one
SampleRegion. - Materialized
Sound Font Asset - A loaded SoundFont plus its provider-owned, bounded zone materialization.
- Playback
Boundary - State machine for a renderer. The renderer consumes
Actionvalues.PlaybackEventremains unchanged and is forwarded intact on note-on. - Playback
Config - Provider
Capabilities - Capabilities advertised by a separately licensed SoundFont provider.
- Resolved
Preset Zone Metadata - Fully resolved, provider-neutral metadata for one playable preset zone.
- Sample
Cache - Small deterministic FIFO sample cache. The provider owns decoded sample memory.
- Sample
Loop - Sample
Region - A provider-neutral SF2/SF3 sample region selected by key and velocity.
- Sample
Voice Parameters - Sound
Font Asset - Sound
Font Preset - Sound
Font Preset Zone - A provider-neutral mapping from one bank/program preset to a playable sample zone.
- Sound
Font Zone Location - Source coordinates inside an SF2/SF3 preset/instrument table.
- Sound
Font Zone Snapshot - Owned, deterministic zone metadata suitable for a browser/worker snapshot.
Enums§
- Action
- Error
- Sample
Action - Sample
Channel Layout - PCM layout needed to decode one materialized SoundFont sample region.
- Sample
Compression - Compression handled by a provider. Decoding remains outside this crate.
- Sound
Font Format - Sound
Font Zone Diagnostic - Typed, non-fatal information reported while a provider materializes zones.
- Stereo
Channel - The channel represented by one member of a linked stereo sample pair.
- Voice
Stealing
Constants§
- MAX_
ASSET_ BYTES - MAX_
DECODED_ FRAMES - MAX_
MATERIALIZED_ ZONES - Maximum number of provider-materialized zones retained in one snapshot.
- MAX_
POLYPHONY - MAX_
PRESETS - MAX_
ZONE_ DIAGNOSTICS - Maximum number of non-fatal provider diagnostics retained in one snapshot.
- PLAYBACK_
CONTRACT_ VERSION - PROVIDER_
CONTRACT_ VERSION - Version of the provider capability/decoder/renderer adapter contract.
- SUPPORTED_
GENERATORS - Generator names understood by the provider-neutral zone contract.
Traits§
- Sample
Decoder - A separately licensed provider that decodes a selected region into PCM.
- Sample
Renderer - A host/provider-owned renderer for validated PCM and scheduled voice actions.
- Sound
Font Provider - Complete adapter contract for an optional, separately licensed provider.
Functions§
- decode_
materialized_ sample_ region - Decode a region from a
MaterializedSoundFontAssetsnapshot. - decode_
sample_ region - Decode one validated SoundFont region into PCM with buffer-relative loop coordinates.
- decode_
sf2_ pcm16 - Decode an interleaved little-endian PCM16 sample from an SF2
smplchunk. - decode_
sf3_ vorbis - SF3 decoding is intentionally unavailable unless a licensed Vorbis provider is selected.
- decode_
sf3_ vorbis_ sample - See
decode_sf3_vorbis_sample. This explicit fallback preserves the feature-gated compression boundary for callers that retain sample IDs. - load
- Load only the bounded, path-independent metadata needed by a renderer.
- load_
materialized - Load a SoundFont and materialize the supported preset/instrument generator subset.
- render_
sample_ action - Render one scheduled sample action into deterministic interleaved PCM16 frames.
- render_
sample_ region_ action - Render an action against a
DecodedSampleRegionusing its normalized loop coordinates. - resolve_
preset_ zone_ metadata - Resolve and return owned metadata for a bank/program/key/velocity request.
- schedule_
preset_ note_ on - Select a bank/program/key/velocity zone and build its provider-neutral voice plan.
- schedule_
preset_ note_ ons - Build one provider-neutral note-on action for every matching layered preset zone.
- schedule_
sample_ note_ on - Build a deterministic provider action for one
PlaybackEventand selected region. - select_
preset_ zone - Select a preset zone deterministically for a bank/program/key/velocity tuple.
- select_
preset_ zones - Return every playable preset zone in deterministic order for a note request.
- select_
sample_ region - Selects a region deterministically: narrower key/velocity zones win, then sample ID.
- validate_
generator_ name - Reject a parsed SoundFont generator that this boundary cannot represent safely.
- validate_
provider_ capabilities - Validate that a region can be handed to the advertised provider capabilities.
- validate_
sample_ region - Validate the bounded generator values needed to turn one zone into a playable voice.
- velocity_
gain - Converts MIDI velocity to a deterministic linear gain with a configurable exponent.