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

STEPS_PER_BEAT

Classes

ChordNote

One note sounding on a step.

StepNoteEvent

Sequencer note with its length in steps; milliseconds follow the tempo.

Functions

ms_per_step(bpm) → float

Length of one 16th-note step in milliseconds at bpm.

Module Contents

jdxi_editor.ui.editors.pattern.step_note.STEPS_PER_BEAT = 4[source]
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.ChordNote[source]

One note sounding on a step.

note: int[source]
velocity: int = 100[source]
duration_steps: float = 1.0[source]
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.NoteButtonEvent

Sequencer note with its length in steps; milliseconds follow the tempo.

tempo_bpm: float = 120.0[source]
duration_steps: float | None = None[source]
extra_notes: list[ChordNote] = [][source]
notes() → list[ChordNote][source]

Every note on the step, main note first (empty when inactive).

has_note(note: int) → bool[source]
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).

remove_note(note: int) → bool[source]

Remove note; removing the main note promotes the first extra note.

property duration_ms: float | None[source]