sample-loader
A powerful and easy audio buffer loader for browser:
var ac = var load = ac // a simple audio buffer player (use `sample-player` instead) { var source = ac sourcebuffer = buffer source sourcestartaccurrentTime}
Features
- Load individual audio files or collection of them
- Load base64 encoded audio strings
- Compatile with midi.js soundfonts
- Ready to use instruments with no setup
Install
Via npm: npm i --save sample-loader
or grab the browser ready file (4kb) which exports loader
as window globals.
User guide
sample-loader
is a flexible function to load samples from server. You can create a loader with an AudioContext instance and an (optional) options hash map:
var loader = var ac = var load =
The returned load
function receives only one parameter: the samples to load and returns always a Promise.
Load audio files
You can load individual or collection of files:
Load soundfont files
You can load midi.js soundfont files, and works out of the box with Benjamin Gleitzman's package of
pre-rendered sound fonts. No server setup, just prepend @soundfont
before the instrument name:
Other instruments
Can load drum-machines by prepending @drum-machines
before the instrument name:
Add instrument sources
You can add you own server samples repositories with the options
parameter:
var load =
and then:
License
MIT License