readme
The web audio api used by decibal.js does not currently work with IE and older releases of Firefox, Chrome, Safari, or Opera.
Decibal.js streamlines the importing, decoding, and playback of audio files using the Web Audio Api.
you can create an array of links, or a 2d array of file names and links
an array containing only links
var source = ['../audioFiles/example.mp3']; //returns {src1 : AudioBuffer }
an 2d array of source names and links
var source = [['exAudio1', '../audioFiles/example.mp3']]; // returns {exAudio1 : AudioBuffer}
create a new instance of decibel
var auido = new Decibel();
create a var to hold the decoded files
var audioFiles;
the decodeAudioFiles method takes in an array and returns an object using a promise structure
audio.decodeAudioFiles(source).then(function(decoded){
// success
audioFiles = decoded;
console.log("audioFiles loaded");
}).catch(function(err){
// error
console.error(err);
});
upon success the audioFiles var will look like:
{
src1 : AudioBuffer,
src2 : AudioBuffer,
src3 : AudioBuffer,
src4 : AudioBuffer // ... and so on
}
once the audio files have been loaded, you can use the playback method to play the individual files
audio.playback(audioFiles.src1);
- control facades for play, stop, rewind, fastforward
- effect facades for audio tracks
- dynamic playback controls (speed, length)
- track/ file selection
- track editing
- live stream facades
- and many more...
MIT