Open source libraries

I would like to learn about open source libraries that can be used to perform some simple tasks in MIDI files:

  • reading a file with one record - or a chord - at a time;
  • extracting this tool to re-encode it separately in a new file;
  • allow you to create a "custom" score - I mean, I should be able to change the way I create music from midi using libraries ... I assume that this will require interaction with Lilypond or Musixtex.

I really don't have a preferred language, unless it is too painful to make a cross-platform application. Other tips are welcome - it’s better to study it now, and not when I already wrote a lot of code. So far I have been trying to dig out the source code of MuseScore (C ++), but it seems that the GUI code permeates most of the files, and although defining the corresponding files was easy, it is difficult for me to extract only what I need (I am only for the command line application directly Now, I will see about the interfaces later).

Any ideas?

Thanks!

+4
source share
2 answers

Well, I'm just getting started, but this (in Python) seems promising.

+2
source

If you are still working on a project and the language is not a problem, you can try the cross-platform Python music21 , which can analyze MIDI files in Notes, Chord, Instrument, etc., objects, allows you to manipulate the results, and then R / T back to MIDI or output to Lilypond, etc. (full disclosure, I am the author of a toolbox; but I do not know many others in any language that will accept MIDI files and put Lilypond out, giving you the ability to treat MIDI elements as objects for manipulating in the meantime.).

Sample code to screw all instrument sounds into a MIDI file, and then play it and make lilypond.pdf from it:

import music21 mf = music21.converter.parse('pathToMidiFile.mid') for x in mf.recurse(): if 'Instrument' in x.classes: x.midiProgram = (x.midiProgram * 2) % 128 mf.show('midi') mf.show('lily.pdf') 

Hope this helps.

+2
source

Source: https://habr.com/ru/post/1302937/


All Articles