MML (BASIC “PLAY” command) import

• Mar 28, 2016 - 04:06

Hi all,

not exactly a plugin, but I just finished writing a MusicXML exporter into Floppi-Music, which plays (parallel and multi-instrument) MML files on floppy drives. This exporter can be used stand-alone.

Example use:

$ git clone https://github.com/Natureshadow/floppi-music.git
$ cd floppi-music/src/floppi/
$ python music.py songs/alle_meine_entchen.mml >~/alle_meine_entchen.xml
$ musescore ~/alle_meine_entchen.xml

The “Alle meine Entchen” example is rudimentary; the Pachelbel Canon is a much better example for the capabilities of the MML format and the conversion software. Some minor postprocessing in MuseScore (such as connecting the eigth, 16th and 32th notes together) and it’s ready for printing, MIDI export, etc. thanks to our favourite score editing software ☻

To run this, all you need is a Python interpreter (version 2.5, which is about 16 years old, or newer ☺) and the music.py file from that repository… and content in the extended MML file format, of course.

There’s also a documentation of the MML format ; this extended format differs in that it uses the | character to embed bars, for synchronisation, and supports multiple instruments (each on its own line, continued after a blank line for wrapping).

For archival purposes, I’m attaching the script and a plaintext version of the documentation.

Attachment Size
mml2musicxml.zip 11.29 KB

Comments

In reply to by [DELETED] 5

I don’t know about Nintendo, but decades of BASIC users have used it, probably as kids. Even the examples that came with MS-DOS had sound in them, generated with MML play strings.

MusicXML to MML (or an MML export plugin for MuseScore) would be extremely hard because MML has a rather limited feature set (subset, except for the legato handling). I’m probably not going to write this myself due to my limited experience with GUI stuff, but I could see a MuseScore MML export plugin that also marks (colours red?) anything in the score that cannot be exported correctly, so it can be fixed before export.

But for people authoring MML files, one direction is probably already a godsend because it at least allows, and rather quick at that, the visualisation of what one did on the MML side (to correct mistakes, like these in the Pachelbel Canon example). Kinda like HTML editing: you edit the text, the browser converts that to a graphically laid-out page and shows that to you, you change more in the text and check the result, etc.

Update: the author of floppi-music did not quite like my integrative approach, but he preserved the easy-to-use example in a branch. So, change the first line to add a branch.

I’ll repeat the complete example with a musically a bit more interesting (although slightly broken, in MuseScore one can see why) file:

$ git clone -b mirabilos-musicxml https://github.com/Natureshadow/floppi-music.git
$ cd floppi-music/src/floppi/
$ python music.py songs/pachelbel_canon.mml >~/pachelbel_canon.xml
$ musescore ~/pachelbel_canon.xml

I expect the fixed MML files to show up at https://github.com/Natureshadow/floppi-music/tree/master/songs eventually.

Update: We’re moving out the MML handling and export code into a separate library: https://github.com/Natureshadow/mmllib

I made the above example still work by pushing the last version of the old code as signed tag, though.

Do you still have an unanswered question? Please log in first to post your question.