Exploring Algorithmic Composition and MIDI Programming with Python

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 9K views
Avatrin
Messages
242
Reaction score
6
Python is the only programming language I know, and I know there is a huge library of MIDI music out there.

I want to play around with machine learning and algorithmic composition to see what I can produce.

So, what books should I read to be able to do this? What I am looking for is:

Books to learn about MIDI, and how to use it the way I want to use it.

Books to learn about algorithmic composition.
 
  • Like
Likes   Reactions: Pepper Mint
Physics news on Phys.org
Some python / audio packages:

https://wiki.python.org/moin/PythonInMusic

with a section on Python MIDI packages:

MIDI Mania
  • pygame.midi - is a portmidi wrapper orginally based on the pyportmidi wrapper. Also pygame.music can play midi files. Can get input from midi devices and can output to midi devices. For osx, linux and windows. New with pygame 1.9.0. python -m pygame.examples.midi --output
  • pyMIDI - Provides object oriented programmatic manipulation of MIDI streams. Using this framework, you can read MIDI files from disk, build new MIDI streams, process, or filter preexisting streams, and write your changes back to disk. If you install this package on a Linux platform with alsalib, you can take advantage of the ALSA kernel sequencer, which provides low latency scheduling and receiving of MIDI events. SWIG is required to compile the ALSA extension sequencer extension. Although OS-X and Windows provide similar sequencer facilities, the current version of the API does not yet support them. Some buggs are remaining in this package (for example when trying to delete a track), it has not been updated since 2006. This package is by Giles Hall. A sourceforge download.
  • midi.py - (DEAD LINK) - Python MIDI classes: meaningful data structures that represent MIDI events and other objects. You can read MIDI files to create such objects, or generate a collection of objects and use them to write a MIDI file.
  • MIDI.py - This module offers functions: concatenate_scores(), grep(), merge_scores(), mix_scores(), midi2opus(), midi2score(), opus2midi(), opus2score(), play_score(), score2midi(), score2opus(), score2stats(), score_type(), segment(), timeshift() and to_millisecs(). Uses Python3. There is a call-compatible Lua module.
  • PMIDI - The PMIDI library allows the generation of short MIDI sequences in Python code.The interface allows a programmer to specify songs, instruments, measures, and notes. Playback is handled by the Windows MIDI stream API so proper playback timing is handled by the OS rather than by client code. The library is especially useful for generating earcons.
... more are listed in the article...
 
  • Like
Likes   Reactions: Avatrin and Pepper Mint