Skip to main content

A Python library for interpreting the GoldenPond DSL for making musical chord progressions.

Reason this release was yanked:

A bug crept in where some crucial classes were not publicly visible.

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, 4, 8, 0.8, 0.25)   # k=4, n=8, 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.0.tar.gz (31.4 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.0-py3-none-any.whl (30.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: goldenpond-0.4.0.tar.gz
  • Upload date:
  • Size: 31.4 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.0.tar.gz
Algorithm Hash digest
SHA256 32d91834102e76c07b30712025bc58c5c0b45968ce3c99416ed09427b98cb687
MD5 ac56f6aa46b6cd5d2400004108ef9c37
BLAKE2b-256 6ecf04ea426c2fd3883f69d1a36e4268dd8a73f1dce8f1c61a4e469bbedf45a0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: goldenpond-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 30.7 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2056087d109d2eb3819934bc83f6f14d1a5b494d8f234d25712258ec29382ab3
MD5 1ce3f751d3330be375ebf6e465890ed5
BLAKE2b-256 b24f93b428fa7f7eb70eb057b2def6a099985b6318c7df5d06a41238e874f522

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