michthom / MIDI-to-CNC

Python script to "play" a *.SMF/*.mid file on a 3-axis CNC machine
GNU General Public License v2.0
50 stars 42 forks source link

Added support for python-midi, fixes some midi files. #5

Closed plotkin1996 closed 6 years ago

plotkin1996 commented 6 years ago

As reported in issue #4, some midi files make midiparse.py fail (and for me, 95% of files I have do, through the errors are sometimes from different places, but still "string index out of range"). Now midiparse.py is old and kludgy, so I added support for https://github.com/vishnubob/python-midi, which is a bit more modern and clean. The advantage of midiparse.py is, of corse, that it is only one small file, and not a full-blown library to install through pip (although I think it is possible to strip python-midi of most fancy stuff and package it directly). I have two versions in this pull request. The first, mid2cnc-python-midi.py, drops midiparse.py alltogether and always uses python-midi. The second allows to choose which library to use via "-pymidi" key. Since supporting both libraries natively would make the code a total mess, it uses an interface conversion kludge (midicludge.py), which is by no means complete, but still for our purposes.

michthom commented 6 years ago

Wow! Thanks Valentin, this looks like a good piece of work and (as you can probably guess) I've not done much with the project in some considerable time. I'm torn between (gratefully!) merging your pull request, and closing down my repo, leaving your branch as the master? (My thinking is that I'm unlikely to look after the code you have provided as well as you could yourself...) What do you think? I suppose I could merge your changes but then announce that further development by me will cease, and then see what happens?

plotkin1996 commented 6 years ago

That's fine, through I'm not sure how much will I able to do beyond this one. By the way, thanks for this awesome work of creativity I'd never be able to come up with myself.

michthom commented 6 years ago

OK, I won't ask you to take over as maintainer then ;-) I've merged your code with thanks, I love how this cooperative model works. Oh and by the way - the original work wasn't mine, I just added some options to cover other machines, way back when I still had a 3D printer to play with!