Skip to main content

Crate nord_format

Crate nord_format 

Source
Expand description

Parse and write Clavia / Nord keyboard binary file formats.

This is an unofficial, community project: not affiliated with, endorsed by, or supported by Clavia DMI AB. “Nord” and the instrument names are Clavia’s trademarks, used here only to identify which files this crate reads.

The formats — programs, live slots, songs, settings, presets, synth patches, sample and piano libraries, across the Nord keyboard range — are reverse engineered from specimen files and hardware observation, never from Clavia’s software, and are in varying states of completion: some bodies decode to named fields, others are container-verified and kept verbatim. formats is the map of what exists and how far each format’s decoding goes.

Completeness never gates I/O. Every supported file reads and writes whether its body decodes fully, partially, or not at all: decoded values are views over a verbatim body, bits no field claims survive untouched, and to_bytes(from_stream(x)) == x bit-for-bit (archives are read-only). That invariant is tested against a private corpus of real files.

from_path / from_stream sniff any supported file and decode it into an Entity; to_bytes is the inverse.

Runtime dependencies are crcxx and thiserror (plus zip behind the bundle feature), and no I/O happens beyond Read/Seek/Write, so the crate runs anywhere std does — wasm included. Device access lives in the companion nord-usb crate, in the same repository.

Modules§

accept
Which format tags an instrument family takes, and the class it keeps each of them in.
bank
A bank of slot-addressed items, and the names the instrument gives them.
bits
Typed bit fields over a panel’s bytes.
cbin
The CBIN container: one type owning what every Nord file format shares — the header (both generations), the checksum policy, and the length bookkeeping.
components
Typed values shared across models.
crc
The container’s two checksums, as slices and as streams.
error
What can go wrong: ParseError for a file that violates its format, Error folding that together with I/O (and ZIP, under bundle).
fields
Field-level introspection over a #[bitbody]’s fields.
formats
One module per file format, named for the four-character CBIN tag it carries — or, where a model family shares a prefix across several tags, for that prefix; or, where the tags share no usable prefix (nsclassic, np), for the model.
layout
Body layouts as data.
note
MIDI note names, the spelling the formats’ key ranges are read and written in.
panel
What a body’s fields are to a player: which controls sit together, and which of them the instrument is using for the state the file holds.
types
Range-checked integers for bit-packed fields — an out-of-range stored value is a decode error, never a silent wrap.
util
Container sniffing: classify a stream by its leading bytes, before any format-specific reader runs.
wav
A minimal RIFF/WAVE reader and writer, for moving audio in and out of the codec.

Structs§

Identity
What an entity is: a human label and the format tag its file carries.

Enums§

Bundle
A ZIP archive: an Electro 5 bundle or backup, or a Drum-family bank.
Entity
One decoded file.
Live
The live buffer — the panel as it stands, not a saved program. Same body as Program, under its own format tag.
OrganPreset
A stored organ preset, on the models that keep them as files.
Performance
A Lead performance — the multi-slot layer above that family’s programs.
PianoPreset
A stored piano preset, on the models that keep them as files.
Program
A stored program, one variant per model. Only the Electro 5 and the three Stages decode anything of the body; the rest are container-verified stubs.
Sample
A sample instrument, decoded by generation: all three share the nsmp tag, and the header version says which schema the body holds.
Settings
The instrument’s global settings, one variant per model. Only the Electro 5 body decodes; the rest are container-verified stubs.
Song
A stored song / set list, one variant per model that has them. Only the Electro 5 body decodes; the Stage 3 is container-verified verbatim.
Synth
A synth patch, on the models that bank them separately from programs. Only the Stage 4’s decodes.

Functions§

from_path
from_stream over a buffered read of the file at path.
from_stream
Sniff reader and decode one supported file into an Entity — the counterpart to to_bytes. The container class comes from the leading bytes; a CBIN body is then dispatched on the format tag at offset 8.
to_bytes
Serialize an Entity back to the bytes of its file — the counterpart to from_stream.