Module src.backends.note_state
Active MIDI note state backend (Channel version) Reads the latest active notes snapshot from a shared thread channel (“active_notes”), caches its list of MIDI notes, and exposes lookup functions.
Functions
| getActiveNotes () | Returns the raw list of active MIDI notes. |
| isNoteActive (stepIndex) | Check if a given circle-of-fourths step is active. |
| isNoteBass (stepIndex) | Check if a given step is the bass (lowest) active note. |
| isNoteHighest (stepIndex) | Return true if the given stepIndex (1–12) is the highest active pitch’s step. |
Tables
| note_state | Module table returned by this file. |
Functions
- getActiveNotes ()
-
Returns the raw list of active MIDI notes.
Reloads the channel snapshot before returning.
Returns:
-
table
list of MIDI note numbers (array of integers)
- isNoteActive (stepIndex)
-
Check if a given circle-of-fourths step is active.
The function accepts a 1–12 step index and maps it to internal 0–11 step0.
Parameters:
- stepIndex number Circle-of-fourths step index (1–12)
Returns:
-
boolean
true if the step is currently active
- isNoteBass (stepIndex)
-
Check if a given step is the bass (lowest) active note.
Returns false if the step is not active or if there are no active notes.
Parameters:
- stepIndex number Circle-of-fourths step index (1–12)
Returns:
-
boolean
true if the step corresponds to the lowest active MIDI note
- isNoteHighest (stepIndex)
-
Return true if the given stepIndex (1–12) is the highest active pitch’s step.
Mirrors the bass checker but for the highest MIDI note.
Parameters:
- stepIndex number Circle-of-fourths step index (1–12)
Returns:
-
boolean
true if the step corresponds to the highest active MIDI note
Tables
- note_state
-
Module table returned by this file.
Fields:
- getActiveNotes function Returns the raw list of active MIDI notes
- isNoteActive function Check if a given circle-of-fourths step is active
- isNoteBass function Check if a given step is the bass (lowest) active note
- isNoteHighest function Check if a given step is the highest active pitch’s step