Skip to content

newIns.md documents SID3 filter scaling center notes as 1 byte; the fork writes 2 #11

Description

@axionbuster

Problem

papers/newIns.md describes the SID3 per-filter scaling center-note fields as single bytes holding a 12-EDO note value:

  1  | cutoff scaling center note: `0` is `c_5`, `1` is `c+5`, ..., `179` is `B-9`
  1  | resonance scaling center note: `0` is `c_5`, `1` is `c+5`, ..., `179` is `B-9`

Both the field width and the value range are wrong for this fork's current instrument format.

Actual behavior

src/engine/instrument.cpp writes both fields as 16-bit values:

w->writeS(sid3.filt[i].bindCutoffToNoteCenter);
w->writeS(sid3.filt[i].bindResonanceToNoteCenter);

The read path branches on format version, taking readS() for current files and readC() for older ones. Legacy values are migrated with DIV_EDO31_LEGACY_OFFSET and clamped to DIV_EDO31_MAX_SLOT, so the stored value is a slot in the 465-slot 31-EDO domain, not a 12-EDO note number. FREQ_FOR_NOTE in src/engine/platform/sid3.cpp interprets it against DIV_EDO31_A4 and DIV_EDO31_STEPS, confirming the 31-EDO reading.

179 is therefore not B-9 here. In this fork's domain, slot 179 is Bbb0, and B-9 is slot 462.

Impact

This is the fork's own format specification, so anyone writing a parser from it will misread every byte after the first scaling field in an SID3 instrument — a size error, not just a mislabeled range.

Suggested fix

Document both fields as 2 bytes for the current format version, note the 1-byte form for earlier versions the way other version-dependent fields in this file already are, and give the value range as slots in the 465-slot domain.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions