-
Notifications
You must be signed in to change notification settings - Fork 433
Support loading lyrics from midi #1769
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
hi @oxygen-dioxide -- can you add tests including doctests for |
|
Added tests for lyrics importing. The song for testing is a small part of Haydn's String Quartet Op. 76 with Chinese and Korean lyrics. |
|
Almost there -- can you fix the errors in flake8 run: fixing those should fix the pylint also. Because |
|
Closing and Reopening to get a clean slate. |
|
Hi @oxygen-dioxide -- Great PR -- there are still a few changes I wanted to make but they were easier for me to do because they mostly touched on parts of the system that were pre-existing. As far as "-" getting translated to slurs automatically, I'm not going to put that into the music21 MIDI parsing routines unless it becomes a standard (or de-facto standard) across all of MIDI. I'd be glad to put example code of how to do this after the fact somewhere in the documentation system. Glad to know that automatic singing systems are also using music21 --I'd very much enjoy talking to you about what you're doing sometime! |
midi.translate improvements Followup from #1769 gave me an opportunity to find places to improve midi translate. Pinging @oxygen-dioxide since some changes took place since then * Change `getNotesFromEvents()` from potentially O(n^2) to O(n) while retaining sort order. * Pass encoding to parsing of instrument names in addition to lyrics (renamed "encoding_type" to "encoding" -- missed in prior review) * create TimingNoteEvent which is a typed NamedTuple that keeps track of when a MidiEvent NoteOn started, stopped, and what the NoteOn event was. Replaced the old tuple of tuples. * Faster gathering of Chords (remove potential O(n^2) search). * Remove unused special case for single-note streams. * opFrac many offsets and durations in MIDI for absolutely correct tuplets, etc. * Misc: Update braille.translate SegmentKey to typing.NamedTuple * Misc: Search code for places where we were still casting to float for Python 2 division! * Misc: Add typing to text/Trigram and some layout things This is part of the non-backwards compatible MIDI.translate guts rewrite discussed on the music21 list. Coverage % is expected to drop because the amount of code has been reduced a lot.
|
For the "'-' to slurs", I found that music21 doesn't allow "-" as note lyric. I understand that we don't make it builtin because it isn't a standard, but if a developer wants to convert "-" to slurs in their own python code, they can't, because all the infos about "-" lyrics are cleared when loading the midi file into music21. |
|
Instead of setting ".lyric" on a note in MIDI output we should create a Lyric object and set the "rawText" to the value. That way it will preserve the hyphen. Currently it should set the lyric to the Lyric continue type. |


Midi files can contain lyrics. Many music creation softwares that deal with lyrics, especially sheet music editor and singing voice synthesizers, such as Musescore and OpenUtau, can create midi file with lyrics. After this PR, we can load lyrics from midi files.
#356 will be solved.