Module src.systems.note_system
Manages a 12-note system, syncing MIDI‐driven note activation to joint visuals.
Supports circular shifts, and both “instant” and “offset” activation modes.
Class Note
Note:new (idx, name, jointObj) | Construct a new Note object. |
Class NoteSystem
NoteSystem:toggleNoteMode () | Toggle between “instant” and “offset” note modes. |
NoteSystem:new (scene) | Create a new NoteSystem bound to a scene. |
NoteSystem:shift (offset) | Shift all note slots by a given offset. |
NoteSystem:update (dt) | Update note and bass states based on MIDI input. |
Class Note
Single‐note abstraction, tracking its slot, name, visual joint, and state.
Class NoteSystem
The main note system, managing 12 Note instances and their state.
- NoteSystem:toggleNoteMode ()
-
Toggle between “instant” and “offset” note modes.
Returns:
-
nil
- NoteSystem:new (scene)
-
Create a new NoteSystem bound to a scene.
Initializes 12 Note objects and their previous‐state tables.
Parameters:
- scene
table
Scene containing
scene.joints
Returns:
- scene
table
Scene containing
- NoteSystem:shift (offset)
-
Shift all note slots by a given offset.
Positive values rotate slots right; negative rotate left.
Rebinds each Note to the correct joint object afterward.
Parameters:
- offset number Number of slots to shift
Returns:
-
nil
- NoteSystem:update (dt)
-
Update note and bass states based on MIDI input.
In “offset” mode, uses timers to delay deactivation.
In “instant” mode, applies state changes immediately.
Parameters:
- dt number Delta time in seconds since last frame
Returns:
-
boolean
True if any note or bass state changed