[LAU] command line midi processing

Christopher Arndt chris at chrisarndt.de
Thu Aug 30 16:00:43 CEST 2018


Am 30.08.18 um 02:44 schrieb Maurizio Berti:
> Well, there is python-midi, which is stable enough:
> https://github.com/vishnubob/python-midi/

Another Python MIDI file library (which I wrote based on a really old
predecessor) is miditk-smf:

https://pypi.org/project/miditk-smf/

It uses an event-based approach, i.e. it works great for filtering and
changing MIDI events as they are read in. Here's an example of how you
would map MIDI program change events from one program number to another,
optionally only on selected MIDI channels or tracks in the MIDI file:

https://gist.github.com/SpotlightKid/e7f787cc142c45399f71296ac8a3de57

If you want to change the timing of events, the filtering approach is
not appropriate. miditk-smf also has support for parsing a complete MIDI
file into a MidiSequence object, which is a container for all the events
of the file, but unfortunately there is no direct support for writing
these events back to MIDI file yet.


Chris


More information about the Linux-audio-user mailing list