5.2.0 • Published 3 years ago

@generative-music/piece-day-dream v5.2.0

Weekly downloads
112
License
MIT
Repository
github
Last release
3 years ago

pieces-alex-bainter

A collection of generative music pieces for generative.fm.

Installation

Each piece is available via npm under the @generative-music scope. For example, the piece "Observable Streams" can be installed like so:

npm i @generative-music/piece-observable-streams

Usage

IMPORTANT: The pieces use audio files hosted on samples.generative.fm, which does not support requests from unrecognized origins.

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:

  • audioContext: An instantiated implementation of the Web Audio API AudioContext interface.
  • destination: An AudioNode to which the piece's own nodes will be connected.
  • preferredFormat: A string containing the audio format to use for any audio files. Currently accepted values are ogg and mp3.

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';

// Detect ogg support, otherwise use mp3
const preferredFormat = document.createElement('audio').canPlayType('audio/ogg') !== '' ? 'ogg' : 'mp3';

makePiece({ audioContext: Tone.context, destination: Tone.Master, preferredFormat }).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
})
5.2.0

3 years ago

5.1.0

3 years ago

5.0.2

3 years ago

5.0.1

3 years ago

5.0.0

3 years ago

4.8.0

3 years ago

4.7.0

3 years ago

4.5.0

3 years ago

4.4.0

3 years ago

4.3.1

3 years ago

4.3.0

3 years ago

4.2.0

4 years ago

4.0.0

4 years ago

3.3.0

4 years ago

3.2.6

4 years ago

3.2.3

4 years ago

3.1.1

4 years ago

3.1.0

4 years ago

3.0.0

4 years ago

2.36.0

4 years ago

2.35.0

4 years ago

2.34.0

4 years ago

2.33.0

4 years ago

2.32.0

5 years ago

2.31.0

5 years ago

2.30.0

5 years ago

2.29.0

5 years ago

2.28.0

5 years ago

2.27.0

5 years ago

2.26.0

5 years ago

2.25.0

5 years ago

2.24.0

5 years ago

2.23.0

5 years ago

2.22.0

5 years ago

2.21.0

5 years ago

2.20.0

5 years ago

2.19.0

5 years ago

2.18.0

5 years ago

2.17.0

5 years ago

2.16.0

5 years ago

2.15.0

5 years ago

2.14.0

5 years ago

2.13.1

5 years ago

2.13.0

5 years ago