计划执行与检查节点
executing-plans
按既定实施计划完成工作,保持过程检查和反馈。
midi-preprocessing【效率与协作】Inspect and adapt deepjazz MIDI preprocessing, Metheny part assumptions, and grammar corpus extraction before LSTM generation.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this sub-skill when a task is about preparing or diagnosing MIDI input for deepjazz: checking whether a file matches the default Metheny assumptions, changing melody/accompaniment part selection, extracting chords and measures, or producing grammar corpus inputs for the LSTM route.
Do not rely on reading or running the original preprocessing script at runtime. This sub-skill distills the relevant behavior and provides a safe bundled inspection helper.
parse_melody, unparse_grammar, pruning, and note cleanup, use ../grammar-and-qa/.../lstm-generation/.../../references/troubleshooting.md.Make sure music21 can parse the candidate MIDI file.
Run the bundled structure inspector before training or changing generator settings:
python scripts/inspect_midi_structure.py --midi-file <input.mid> --melody-part 5 --accompaniment-parts 0,1,6,7 --start-offset 476 --end-offset 548
If the report warns that the melody part, accompaniment parts, or offset window do not contain the expected material, adapt the part indices/window before sending the file to the LSTM workflow.
Only after the file has plausible melody and chord material should you route to grammar extraction or generation.
references/midi-preprocessing.md for the distilled get_musical_data(data_fn) and get_corpus_data(abstract_grammars) workflow, including the output objects expected by generation.references/data-assumptions.md before applying deepjazz to a new MIDI file; it lists the hard-coded Metheny arrangement assumptions and what to change.references/troubleshooting.md when music21 cannot parse a file, part indices fail, no chords appear, or measure/chord lengths do not match.scripts/inspect_midi_structure.py for a deterministic, no-training/no-playback report on MIDI parts, voices, offsets, chord-like events, and selected-window warnings.| Function | Inputs | Returns | Notes |
|---|---|---|---|
get_musical_data(data_fn) | path to a MIDI file | (chords, abstract_grammars) | Internally parses the MIDI, selects hard-coded parts/window, groups measures, and converts melody measures into grammar strings. |
get_corpus_data(abstract_grammars) | list of grammar strings | (corpus, values, val_indices, indices_val) | Flattens grammar tokens for LSTM sequence modeling and builds token-index maps. |