jdxi_editor.midi.pattern.importer
Pattern importer
Reads a MIDI file into step-sequencer notes. Used both for “Load Pattern” and for loading the MIDI File Player’s file, so both behave the same:
every track is read; notes are mapped to rows by MIDI channel
note starts are rounded to the nearest 16th-note step
note lengths and velocities are kept (lengths in steps, from the note-offs)
notes that start on the same step of a row (chords, simultaneous drum hits) are all kept, in file order; the first is the step’s main note
what cannot be represented is counted, not silently lost: notes on other channels, the same note starting twice on one step, and tempo changes after the first
The inverse of jdxi_editor.midi.pattern.compiler.compile_pattern for files it produced.
Attributes
Classes
A note placed on the step grid. |
|
Result of reading a MIDI file into the step grid. |
Functions
|
|
|
Place the notes of midi_file on the step grid. |
Module Contents
- class jdxi_editor.midi.pattern.importer.PatternImport[source]
Result of reading a MIDI file into the step grid.
- notes: list[ImportedNote] = [][source]
- jdxi_editor.midi.pattern.importer.import_pattern(midi_file: mido.MidiFile, channel_to_row: dict[int, int], steps_per_bar: int = DEFAULT_STEPS_PER_BAR) PatternImport[source]
Place the notes of midi_file on the step grid.
- Parameters:
midi_file – File to read
channel_to_row – 0-based MIDI channel -> sequencer row
steps_per_bar – Steps per bar (16 for 4/4, 12 for 3/4)
- Returns:
PatternImport with notes and a count of what was left out