Skip to content

wavesjs/waves-loaders

Repository files navigation

waves-loaders

module for loading WebAudio buffers (and other loading utilities).

Installation

npm install [--save] waves-loaders

Example

loading one file

import * as loaders from 'waves-loaders';

const loader = new loaders.AudioBufferLoader();
loader.onProgress(progress => console.log(progress));
// { value:.., total:..., loaded:... }

async function init() {
  await buffer = loader.load('sound/file/url');
  // do something with `buffer`
}

loading multiple files

import * as loaders from 'waves-loaders';

const loader = new loaders.AudioBufferLoader();

async function init() {
  await buffers = loader.load(['sound/file-1', 'sound/file-1']);
  // do something with `buffers[0]` and `buffers[1]`
}

License

This module is released under the BSD-3-Clause license.

Acknowledgments

This code is part of the WAVE project, funded by ANR (The French National Research Agency), ContInt program, 2012-2015.