Skip to main content

Module instrument

Module instrument 

Source
Expand description

SFZ/SF2/DLS instrument LOADERS + hypermedia/vendor resolver + licence provenance.

Qualia ships NO sample content. This module implements the open, dependency-free loaders and a resolver over USER-supplied instrument files (from the user’s hypermedia library or a user/vendor content dir). SFZ is parsed from the open plain-text spec (no vendored sfizz); SF2/DLS are enumerated from their RIFF headers WITHOUT decoding sample audio. Each resolved instrument carries a LicenceTag as provenance so downstream export/share can fail closed on non-commercial / no-redistribution assets. See the delivery plan Wave M (“Engine vs content”). Lane AU-MIDI-INSTRUMENT. Re-exports only.

Structs§

DlsCollection
Enumerated instruments of a DLS collection.
DlsInstrument
One DLS instrument descriptor (no wave audio).
InstrumentPreset
A format-neutral instrument preset.
ResolvedInstrument
A preset bound to its content location(s) and stamped with licence provenance.
ResolvedSample
One resolved sample reference: the original relative reference plus, where a base/lookup was supplied, the concrete location it maps to.
Sf2Preset
One SoundFont2 preset descriptor (no sample audio).
Sf2Presets
The enumerated presets of a SoundFont2 file.
SfzInstrument
A parsed SFZ instrument: a bounded, ordered list of regions.
SfzRegion
One key/velocity-mapped region: a rectangle in (note, velocity) space plus playback params.

Enums§

LicenceTag
Licence provenance for user-supplied instrument content.
PresetFormat
Which on-disk format a preset came from.
SampleSource
How a preset’s sample content is located.

Constants§

MAX_INSTRUMENTS
Cap on instruments returned (bounded, DoS-safe).
MAX_PRESETS
Cap on presets returned (bounded, DoS-safe).
MAX_REGIONS
Upper bound on regions in one instrument. A larger file is rejected (bounded, DoS-safe).

Functions§

parse_sfz
Parse an SFZ text instrument into a bounded SfzInstrument.
read_dls_instruments
Enumerate the instruments of a .dls byte buffer.
read_sf2_presets
Parse a .sf2 byte buffer and enumerate its presets.
region_for
Return the first region matching (note, velocity), or None if the instrument has no region covering that key/velocity rectangle.
resolve_instrument
Resolve an instrument preset and attach its licence provenance.
resolve_instrument_with
Resolve an instrument preset, binding each external sample reference against a caller-supplied lookup (e.g. “join base dir” or “hypermedia asset by key”), and attach licence.