Algorithmic Composition Utilities
Project description
Algorithmic Composition Utilities
The aim of the Milton package is to provide a higher level, musically more expressive and abstract set of routines. It is meant to make expressing algorithmic music more intuitive and easy, by taking care of low-level MIDI implementation so that the composer can focus on his composition rather than following midi messages. This package is a work-in-progress and in active development. Your feedback is very welcome! :-)
Install
Run the command pip install milton to install Milton from Pypi.
Quick Start
# import the module
>>> import milton
# First initialize the module,
>>> milton.realtime.init()
# create a single note,
>>> c4 = milton.make_note("c4")
# and put it in a list and send it to the processor to play it.
>>> milton.proc([c4])
# Let us now define a second note with the key number 72, and specify it's starting time (onset) to be 1 second after the processor starts.
>>> c5 = milton.make_note(pch=72, onset=1)
>>> milton.proc([c4, c5])
# You should have heared both notes, played after each other.
# The full signature of the note function has the parameters:
# pch: the name of the note (a string) or the midi key number
# onset: is the ongoing time expressed in seconds, with respect to the process start time 0 (default is 0, which means now)
# dur: the duration of the note
# chnl: the midi channel to play the note on
# vel: the dynamic of the note
# Now we want to create an A minor chord with a duration of 2 seconds,
# and play it 1/2 second after the processor starts,
>>> a_min = milton.make_chord(pchs=(69, 72, 76), onset=.5, dur=2)
# and send it to the processor to play it.
>>> milton.proc([a_min])
# Let us now give the processor a list of notes/chords to play:
# the chromatic scale starting from the middle c upwards.
>>> voice1 = [milton.make_note(pch=60+i, onset=i, dur=0.5) for i in range(12)]
>>> milton.proc([voice1])
# Playing polyphony is as easy as passing multiple lists of note/chords
# to the processor:
>>> voice2 = [milton.make_note(pch=48+i, onset=i+0.5, dur=0.5) for i in range(12)]
>>> voice3 = [milton.make_chord(pchs=[60+i, 60+i+4, 60+i+7], onset=i+0.2, dur=0.5) for i in range(12)]
>>> milton.proc([voice1, voice2, voice3])
# If you want to write a midi file to the disk instead of playing it back
# pass a path string as the second argument to the processor
>>> milton.proc([voice1, voice2, voice3], "/tmp/milton.mid")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file milton-190624.tar.gz.
File metadata
- Download URL: milton-190624.tar.gz
- Upload date:
- Size: 49.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b64a4939ef9c11fed21038debd76a1b9abe2226291effbeff3a4b9a106a386b2
|
|
| MD5 |
59a5a04c756b0d1fe8531b281da4bfc7
|
|
| BLAKE2b-256 |
988a233d34059f7e9aef35fc0434715bc19bc417860f879e13f2fa405be5d1ec
|
File details
Details for the file milton-190624-py3-none-any.whl.
File metadata
- Download URL: milton-190624-py3-none-any.whl
- Upload date:
- Size: 37.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc66d65306297d201528d64042b9329411283027c9e7baf38af74b844e263466
|
|
| MD5 |
df92bc23018b75378d4aadcbbeb72846
|
|
| BLAKE2b-256 |
dc5d4f43a502a7c1c2fd47b9fd1d53bf42d856e565d26795c1f6ad20ec17a4bb
|