{"id":34870540,"url":"https://github.com/interstar/goldenpond-py","last_synced_at":"2026-05-24T02:33:11.655Z","repository":{"id":66874505,"uuid":"218412626","full_name":"interstar/goldenpond-py","owner":"interstar","description":"GoldenPond Python","archived":false,"fork":false,"pushed_at":"2024-04-21T16:12:29.000Z","size":61,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-27T07:58:28.124Z","etag":null,"topics":["foxdot","midiutil","music","python","sonic-pi"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/interstar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2019-10-30T00:51:59.000Z","updated_at":"2024-04-21T16:12:33.000Z","dependencies_parsed_at":"2024-05-08T10:01:03.579Z","dependency_job_id":null,"html_url":"https://github.com/interstar/goldenpond-py","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/interstar/goldenpond-py","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interstar%2Fgoldenpond-py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interstar%2Fgoldenpond-py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interstar%2Fgoldenpond-py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interstar%2Fgoldenpond-py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/interstar","download_url":"https://codeload.github.com/interstar/goldenpond-py/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interstar%2Fgoldenpond-py/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33419556,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-23T22:14:44.296Z","status":"online","status_checked_at":"2026-05-24T02:00:06.296Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["foxdot","midiutil","music","python","sonic-pi"],"created_at":"2025-12-25T23:16:21.642Z","updated_at":"2026-05-24T02:33:11.636Z","avatar_url":"https://github.com/interstar.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## NOTE: This project and library is now deprecated\nSEE https://github.com/interstar/golden-pond for the later work on this project. The code there has been rewritten from scratch. Soon we hope to reach parity with this project in the sense that the new GoldenPond library will be compatible with FoxDot, among other frameworks and contexts.\n\n### GoldenPond : Music generation in Python\n\nGoldenPond is a Python library for representing music.\n\nI've been using Sonic Pi for a couple of years, but became disappointed with the way that livecoding had evolved to be more or less a tool for making very repetitive loop based music.\n\nGiven the expressivity of a programming lanaguge, why am I basically using it to represent simple grid based sequencers? When I could be expressing far more complex musical structures in elegant code?\n\nHaving discovered [FoxDot](https://foxdot.org/), the Python equivalent to Sonic Pi or TidalCycles, I began to think how I would like to be able to represent complex harmonic structures in code form, in a way that is simple enough to code on the fly.\n\nHence, this library, encapsulating some musical theory.\n\nIt's work in progress. And certainly not elegant enough for me to use live. But keep watching.\n\n### Quick Start\n\n**A note on Dependencies :** Current examples have been designed to work with FoxDot and Python's MIDI file library [MIDIUtil](https://pypi.org/project/MIDIUtil/) which we'll use in our quick start example. But note that MIDIUtil is NOT a dependency of this project. You should install it separately if you plan to use GoldenPond with MIDIUtil. \n\n\n```\n\npip install MIDIUtil\n\ngit clone https://github.com/interstar/goldenpond-py.git goldenpond\n\ncd goldenpond/examples\n\nln -s ../goldenpond goldenpond\n\npython3 midi.py\n\n\n```\n\nThen open example1.mid in your favourite MIDI file player.\n\n### Basic Concepts\n\n\n#### Event Sequences\n\nMusic in GoldenPond is represented as a number of *Event Sequences*. Of which the most common example is the ``EventSeq`` class.\n\nAn EventSeq is, naturally a sequence of ``Event`` objects.\n\nAll Event objects have two properties : some *data*, and a *duration*. \n\nData is currently either a ``Note`` representing a single musical note. Or a ``Chord`` representing a collection of notes that are played at the same time.\n\nDuration is an integer representing how long an event lasts. Measured in \"ticks\" of some abstract clock. A duration of 2 is double a duration of 1. But GoldenPond is not committed to how long 1 tick actually is until we come to render the music in a particular context.\n\nSome Events, when part of an EventSeq will have a third property which is their absolute time (from the beginning of the piece)\n\nMost of GoldenPond's functionality consists of various methods for producing and transforming EventSequences.\n\nFor example, two EventSequences can be concatenated together with the ``+`` operator. And GoldenPond overloads the ``*`` operator so that if you multiply an EventSeq by an integer, *n* it will be produces a longer EventSeq based on *n* repetitions of the EventSeq.\n\nOther operations on EventSequences include *transpose* by a number of semitones. \n\nEventSequences can be *truncated* at a particular step by passing a predicate function. This allows us to say \"stop the sequence at the last event that matches this predicate, but stretch the duration of that last event to fill the remaining duration of all the pruned events\"\n\nEventSequences can have *swing* added to them.\n\nEventSequences can spawn other EventSequences that are musically related. For example, *get_root_seq* creates a new EventSequence containing only the root notes of chords from the parent sequence. This is useful for generating basslines.\n\nEventSeq isn't the only kind of possible EventSequence. We can, for example, implement algorithmic composition rules behind the same EventSequence interface. An example in the current code-base is the ``ScaleChooseSequence`` which randomly chooses notes from a given scale every time it is asked to produce its next note. \n\n#### Notes, Chords and Scales\n\nAlong with Notes and Chords. ``Scale`` objects are the third important class of musical objects. Like Chords, Scales are a collection of musical notes. But are usually used not in concrete musical events but as potentials. ScaleChooseSequence, for example, is given a Scale which represents the set of notes from which it can randomly choose.\n\nNotes, Chords and Scales are all based on the same component : the ``NoteBag`` which holds a collection of musical notes and can do various standard operations such as adding and subtracting from them all (ie. transposing them up or down), concatinating them (ie creating a larger collection of notes). \n\nAnother trick of Scales is the *vamp* method, which takes a timing pattern and returns an EventSequence containing notes taken sequentially from the Scale, according to the rhythmic pattern it is given.\n\n#### Building Chord Sequences\n\nMost music stars with an EventSequence of Chords. And to help us construct one, we use the ``ChordSeqBuilder``\n\nChordSeqBuilder has knowledge of diatonic harmony ie. it thinks in terms of degree chords in a particular tonal centre or key. GoldenPond defines a number of symbols or variables which represent the chords to be used in a key. The simplest of these variables / symbols are _1, _2, _3, _4, _5, _6 and _7\n\nHere's a short example :\n\n```\n\n    root = 64 # this is E\n    csb = ChordSeqBuilder()\n    \n    rhyth1 = [2,2,4,4,4]\n     \n    chord_seq = csb.major(root, [_4,_6,_2,_5,_1], rhyth1)\n\n```\n\nIn this example we build a sequence of chords in the key of E major. These chords are the sub-dominant 4th, the submediant 6th, the supertonic 2nd, the dominant 5th and the tonic 1 chord. Their durations are 2, 2, 4, 4, and 4 *ticks* respectively. \n\nWe could expand on this :\n\n```\n\n    chord_seq = (csb.major(root, [_4,_6,_2,_5,_1], [2,2,4,4,4]) + csb.minor(root, [_4,_6,_2,_5,_5, _1], [2,2,4,2,2,4] ) ) * 8\n\n```\n\nThis chord sequence has two phrases, the previous sequence in E major, followed by a very similar sequence in E minor. See how we use the ``+`` operator to concatenate them. \n\nBut then the whole thing is multiplied by 8, ie. repeated 8 times. This now creates the framework for a substancial piece of music in a very concise line of code.\n\n\n\n\n### Using with FoxDot\n\nThe other file in examples is foxdot.py.\n\n\nFoxDot is a Python interface to the SuperCollider engine. So you'll need to install and set up SuperCollider, with the FoxDot Quark. And then install FoxDot itself. \n\nFollow the [FoxDot Installation Guide](https://foxdot.org/installation/).\n\nThen run the SuperCollider IDE and the FoxDot Quark.\n\nNow try going to examples and typing \n\n```\npython3 foxdot.py\n\n```\n\nthis will run FoxDot in a non-interactive mode, generating a score with GoldenPond and playing it in an infinite loop. See the code for commented explanation of how the music is constructed.\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finterstar%2Fgoldenpond-py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finterstar%2Fgoldenpond-py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finterstar%2Fgoldenpond-py/lists"}