A Python library for interpreting the GoldenPond DSL for making musical chord progressions.
Project description
GoldenPond Library
This is the Python version of the GoldenPond Library.
https://github.com/interstar/golden-pond
Quick Start
from goldenpond import Mode, ChordProgression, TimeManipulator
seq = "71,76,72,-75,71,76,72,-75i,77,73,76,<12,77ii,>12,71,96,74ii,75"
MINOR = Mode.getMinorMode()
prog = ChordProgression(48,MINOR,seq)
tm = TimeManipulator().setPPQ(0.8);
chords = tm.chords(prog,0,0)
arp = tm.arpeggiate(prog,7,12,1,0)
bass = tm.bassline(prog,4,8,2,0)
print([x.toString() for x in chords])
print([x.toString() for x in arp])
first_note = arp[0]
print("First Note")
print("Getting individual fields : %s, %s, %s"%(first_note.note,first_note.start_time,first_note.length))
print(arp[0].toString())
GoldenPond is a little language for defining chord-progressions, following the rules of functional harmony, in a convenient, programmer-friendly way.
See https://gilbertlisterresearch.com/GoldenPond.html for more more details.
In this example, we define a chord-progression using the GoldenPond language, and assign it to variable seq
.
The ChordProgression class knows how to parse the string which expresses the chord progression in the GoldenPond language. It must also be given a root note (in this example, MIDI note 48) and a mode (Major or Minor. We get these from the Mode class).
However, while a ChordProgression has successfully turned our sequence into a collection of pitch values, we don't (yet) have these notes organized into a score of events across time. This is the job of the TimeManipulator.
The TimeManipulator takes the ChordProgression and extracts different musical lines from it.
For example, the chords() function, returns the notes of each chord played simultaneously. While the arpeggiate() function returns those notes in the form of arpeggios (ie. each note in the chord slightly later than the previous one).
The arpeggiate function uses a "Euclidean Rhythm" algorithm to spread the notes in time. The values 7 and 12 passed as arguments in this example, are the k
and n
values respectively. The final 0 argument is the initial start time of the whole sequence.
The bassline function returns just the root note of the chord. Again organized rhythmically according to the Euclidean algorithm. A topline function similarly returns the top notes of each chord. And a randline function return randomly chosen notes from the chord.
The Obscure Genesis of this Code
The GoldenPond library is NOT written in Python. It's written in Haxe (https://haxe.org/), a programming language designed to be transpiled to a number of other languages including Python.
The git-repository contains this Haxe code and various scripts used in transpiling and building it into a number of forms. This Python library is just one of them.
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
File details
Details for the file goldenpond-0.3.0.tar.gz
.
File metadata
- Download URL: goldenpond-0.3.0.tar.gz
- Upload date:
- Size: 27.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.12.3 Linux/6.8.0-48-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0402ed1abec4a81f2b5e78cefc5c67f8b3fc4adad1d0e4eb129a4ecc821855b8 |
|
MD5 | d2b8695cfc5439707d262517ef48e7ab |
|
BLAKE2b-256 | 59aec0362ccb1537059191589d7b0d669cf18eeba2ece756af6839a8651d5616 |
File details
Details for the file goldenpond-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: goldenpond-0.3.0-py3-none-any.whl
- Upload date:
- Size: 27.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.12.3 Linux/6.8.0-48-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dd05875036a72bd0499a802ad218efe8d07e2bba4aff6dd055e185d07ab7f3fa |
|
MD5 | 39eb01520e6631a3304daaaf2f0c442e |
|
BLAKE2b-256 | d5833924e47ddb5b261a20c84bc1c9c804384ecee2c495e7de097ea205bb32e0 |