It looks like melodies are being partially overwritten in the buffer at some point. Saving a melody and reading from the ESC shows that it's no longer the same string. I went back to commit 524afcd and it was working, but haven't dug in any deeper yet.