jdxi_editor.ui.editors.pattern.step_note
Step note event
A NoteButtonEvent whose length is stored in steps (16th notes) rather than
milliseconds. Steps are the canonical length, so a note keeps its musical
length when the tempo changes; duration_ms is derived from the pattern
tempo for code that still works in milliseconds.
The pattern tempo is shared by all step notes (there is one Pattern Sequencer); PatternSequenceEditor.set_tempo updates it.
A step can also hold extra notes (a chord, or several drum hits), each with
its own velocity and length; the main note stays in note.
Example
>>> StepNoteEvent.tempo_bpm = 120
>>> note = StepNoteEvent(note=60, duration_steps=2)
>>> note.duration_ms # an 8th note at 120 BPM
250.0
>>> StepNoteEvent.tempo_bpm = 60
>>> note.duration_ms # still an 8th note
500.0
Attributes
Classes
One note sounding on a step. |
|
Sequencer note with its length in steps; milliseconds follow the tempo. |
Functions
|
Length of one 16th-note step in milliseconds at bpm. |
Module Contents
- jdxi_editor.ui.editors.pattern.step_note.ms_per_step(bpm: float) float[source]
Length of one 16th-note step in milliseconds at bpm.
- class jdxi_editor.ui.editors.pattern.step_note.StepNoteEvent(note: int | None = None, duration_ms: float | None = None, velocity: int | None = None, time: int = 0, channel: int = 0, *, duration_steps: float | None = None)[source]
Bases:
picomidi.ui.widget.button.note.NoteButtonEventSequencer note with its length in steps; milliseconds follow the tempo.
- add_note(note: int, velocity: int, duration_steps: float) bool[source]
Add note to the step (as the main note if the step is empty).