by generative-music

generative-music /pieces-alex-bainter

A collection of generative music pieces for generative.fm

454 Stars 49 Forks Last release: Not found MIT License 368 Commits 81 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:


A collection of generative music pieces for Generative.fm.


Each piece is available via npm under the

scope. For example, the piece "Observable Streams" can be installed like so:
npm i @generative-music/piece-observable-streams


The default export of every piece is a function which takes an object parameter and returns a promise which resolves with a cleanup function once the piece is ready.

The object parameter passed to the exported function of a piece should have three properties:

Currently, all pieces use Tone.js which is required to control a piece.

import Tone from 'tone';
import makePiece from '@generative-music/piece-observable-streams';
import getSamplesByFormat from '@generative-music/samples-alex-bainter';

const { wav } = getSamplesByFormat();

makePiece({ audioContext: Tone.context, destination: Tone.Master, samples: wav }).then(cleanUp => { // Starting the piece // Make sure you follow the Chrome Autoplay policy: https://developers.google.com/web/updates/2017/09/autoplay-policy-changes#webaudio Tone.Transport.start();

// Stopping the piece Tone.Transport.stop(); // stop Transport events Tone.Transport.cancel(); // remove all Transport events cleanUp(); // dispose of audio nodes created by the piece })

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.