REF / Music API / Sound Loaders

Ascene . Agraph . Aengine . Anode
Songbook . Song
WSLoader . Sound Loaders
Random . Rhythm . TimeKeeper
MIDI . OSC . HID . Piano
Plot . Envelope . Util
Music Theory with Tonal

right-click to navigate to page sections


Built-in Soundfile Loaders

You can load -in audio sample files from a number of internet resources as well as your workspace using these built-in Soundfile loaders.

These loaders are available to your sandbox scripts via the AudioFileLoaders object. Each loader provides a list of available instruments via its GetInstruments method. Generally a loader encapsulates both the internet location of the sample files as well as an understanding of its table of contents.

You can use a loader to retrieve all samples for a specific instrument via tts GetInst(inst, cfg={}) method. The result of this call is an object whose keys are sound-names and whose values are an array audio samples.

Now we enumerate the loaders currently available. Sometimes you'll see that soundfile player like Hz.Samplo refer to an instrument via a combination of Kit and Instrument Name. The fields of AudioFileLoaders are loosely equivalent to kits.

The example hzplugins/samplo.js loads and plays samples from randomly selected instruments.

The example algorithmic/hanoi shows how to load and play workspace audio files.

Workspace

Loader class: WSInstLoader;

The Workspace loader provides functions to load audio files from your workspace. These may have arrived there by importing our examples or by importing files from your personal sample library. A .json file must acompany the files that enumerates the sound files. If the .json file contains a simple array of sound files, it's considers a box of sounds and its notes are played by the index. If the .json file is an object/dictionary, then the keys should either be standard note-names (for tonal instruments) or standard sound names like "sd" (for snare drum). In general sample-sets can variations for key velocity, etc. General MIDI players often have special sustain-handlers which describe loop endpoints. All of these things are left as an exercise for the intrepid reader.

Fatboy

Loader class: SfLoader;

Sound files live here.

FluidR3_GM, GeneralMIDI

Loader class: SfLoader;

Most files are located here.

The special "percussion" instrument for GeneralMIDI is found here.

MusyngKite

Loader class: SfLoader;

Soundfiles live here.

VCSL

Loader class: VCSLLoader

Soundfiles live here.

Mellotron

Loader class: MellotronLoader

Soundfiles live here.

DrumMachines

Loader class DrumMachinesLoader

Soundfiles live here.

Soundbox

Loader class SoundboxLoader;

Soundfiles live here.