Skip to main content

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, ChordLine, ArpLine, BassLine

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)

# TimeManipulator with PPQ, chord duration and BPM
tm = TimeManipulator().setPPQ(96).setChordDuration(4).setBPM(120)

# Create lines with k, n, gateLength and rhythmicDensity parameters
chord_line = ChordLine(tm, prog, 1, 4, 0.8, 1.0)  # k=1, n=4, 80% gate length, density=1.0
arp_line = ArpLine(tm, prog, 7, 12, 0.5, 0.5)    # k=7, n=12, 50% gate length, density=0.5
bass_line = BassLine(tm, prog, 1, 4, 0.8, 0.25)   # k=1, n=4, 80% gate length, density=0.25

# Generate notes from each line
chords = chord_line.generateNotes(0, 0, 100)  # channel 0, velocity 100
arp = arp_line.generateNotes(0, 1, 100)      # channel 1, velocity 100
bass = bass_line.generateNotes(0, 2, 100)    # channel 2, velocity 100

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 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 where the Line classes come in.

Each Line class (ChordLine, ArpLine, BassLine, etc.) takes a TimeManipulator and ChordProgression and generates notes in different ways:

  • ChordLine: plays all notes in each chord simultaneously
  • ArpLine: plays chord notes as arpeggios using Euclidean rhythms
  • BassLine: plays just the root notes using Euclidean rhythms
  • TopLine: plays just the highest notes using Euclidean rhythms
  • RandomLine: randomly selects notes from each chord

The Euclidean rhythm functions use a "Euclidean Rhythm" algorithm to spread the notes in time. The values k and n passed as arguments control the rhythm pattern. For example, ArpLine(tm, prog, 7, 12, 0.5) will create an arpeggio with 7 pulses spread evenly across 12 steps, with notes 50% of their maximum length.

In this example, you can see we don't do anything with this data except print it out. GoldenPond doesn't play or render the audio. It's purely about parsing this programmer-oriented representation of chord-progressions into a simple data structure. See https://github.com/interstar/golden-pond/blob/main/current/haxe/for-distribution/examples/midi_example.py for an example of using it to make a MIDI file.

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

goldenpond-0.4.2.tar.gz (31.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

goldenpond-0.4.2-py3-none-any.whl (30.9 kB view details)

Uploaded Python 3

File details

Details for the file goldenpond-0.4.2.tar.gz.

File metadata

  • Download URL: goldenpond-0.4.2.tar.gz
  • Upload date:
  • Size: 31.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for goldenpond-0.4.2.tar.gz
Algorithm Hash digest
SHA256 cc43a5d53590484a8d7455253fac0902a4dfbbb0e6ada3e43deda5047260cead
MD5 37ecaea6e3ae9153f2fc9df93eade612
BLAKE2b-256 4f367c38ba357a2a30fd036115548fab4fdebac546edcc0131a4ec7e380e990b

See more details on using hashes here.

File details

Details for the file goldenpond-0.4.2-py3-none-any.whl.

File metadata

  • Download URL: goldenpond-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 30.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for goldenpond-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 627f845d2e418dab86447355d5014f2d34224816b174c93fec7e63ac2ab1a23f
MD5 6673b343501760ff2bab6c5734015586
BLAKE2b-256 59166059a4322dead8785e18e639ec269d63831b695a6661750a82d0f725a499

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page