feat: implement src/midi_export.py — .chord → two-track MIDI

chord_file_to_midi() parses the period in the user's original key (no
transposition), accumulates held-chord segments, then writes two pretty_midi
tracks: chords with root anchored at octave 4 (MIDI 60–71 + intervals) and
bass at octave 2 (MIDI 36–47).  Extension notes are added as a fifth voice
at their standard interval above the root.  Tempo is parameterised; the CLI
wrapper (python -m src.midi_export) supports --tempo BPM.

10 tests cover: file creation, parseability, instrument count and names,
chord/bass note counts for a 4-chord C-major fixture (14 chord + 4 bass),
octave placement assertions, and tempo affecting total duration.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-19 15:56:44 +03:00
parent 868af4ac42
commit 54be1be9ce
3 changed files with 333 additions and 0 deletions
+7
View File
@@ -0,0 +1,7 @@
# title: MIDI export test
# key: C_major
# time: 4/4
# subdivision: 4
# style: user
| C . . . | Am7 . . . | F . . . | G7 . . . |