Expand description
MIDI Tuning Standard (MTS) — clean-room from the open MMA spec.
Two concerns, both native and heap-free on the hot path:
-
Tuning table.
build_tuning_tablecombines a ScalaSclScaleandKbmMappinginto a fixed[f64; 128]of key→frequency.note_frequencyis an allocation-free, panic-free lookup into that table. Tuning is fully PARAMETERISED — the table is a function of the supplied scale + mapping; 12-TET is just one possible input, never hardcoded. -
Single Note Tuning Change SysEx (MTS sub-ID 0x02) —
encode_single_note_tuning/decode_single_note_tuning. Frequency is carried as the MTS 3-byte value: a nearest equal-tempered semitone (MIDI note,8.175799 Hz = note 0) plus a 14-bit fraction of 100 cents.
Structs§
- Single
Note Tuning - A decoded single-note tuning change.
Constants§
- SNTC_
LEN - Byte length of a one-change Single Note Tuning Change SysEx.
Functions§
- build_
tuning_ table - Build the 128-key frequency table from a scale + keyboard mapping, per MTS.
- decode_
single_ note_ tuning - Decode a one-change Single Note Tuning Change SysEx produced by
encode_single_note_tuning. - encode_
single_ note_ tuning - Encode a single-note tuning change as a 12-byte real-time SysEx:
F0 7F <dev> 08 02 <program> 01 <note> <xx yy zz> F7. - note_
frequency - Allocation-free, panic-free key→frequency lookup.
noteis masked into0..128, so anyu8is valid; an unmapped key returns0.0.