Skip to main content

Crate acorde_soundfont

Crate acorde_soundfont 

Source
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§

DecodedSample
Validated PCM returned by a separately licensed decoder.
DecodedSampleRegion
PCM decoded for one SampleRegion.
MaterializedSoundFontAsset
A loaded SoundFont plus its provider-owned, bounded zone materialization.
PlaybackBoundary
State machine for a renderer. The renderer consumes Action values. PlaybackEvent remains unchanged and is forwarded intact on note-on.
PlaybackConfig
ProviderCapabilities
Capabilities advertised by a separately licensed SoundFont provider.
ResolvedPresetZoneMetadata
Fully resolved, provider-neutral metadata for one playable preset zone.
SampleCache
Small deterministic FIFO sample cache. The provider owns decoded sample memory.
SampleLoop
SampleRegion
A provider-neutral SF2/SF3 sample region selected by key and velocity.
SampleVoiceParameters
SoundFontAsset
SoundFontPreset
SoundFontPresetZone
A provider-neutral mapping from one bank/program preset to a playable sample zone.
SoundFontZoneLocation
Source coordinates inside an SF2/SF3 preset/instrument table.
SoundFontZoneSnapshot
Owned, deterministic zone metadata suitable for a browser/worker snapshot.

Enums§

Action
Error
SampleAction
SampleChannelLayout
PCM layout needed to decode one materialized SoundFont sample region.
SampleCompression
Compression handled by a provider. Decoding remains outside this crate.
SoundFontFormat
SoundFontZoneDiagnostic
Typed, non-fatal information reported while a provider materializes zones.
StereoChannel
The channel represented by one member of a linked stereo sample pair.
VoiceStealing

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§

SampleDecoder
A separately licensed provider that decodes a selected region into PCM.
SampleRenderer
A host/provider-owned renderer for validated PCM and scheduled voice actions.
SoundFontProvider
Complete adapter contract for an optional, separately licensed provider.

Functions§

decode_materialized_sample_region
Decode a region from a MaterializedSoundFontAsset snapshot.
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 smpl chunk.
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 DecodedSampleRegion using 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 PlaybackEvent and 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.