Skip to content

MikeAlbo/decibel.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Decibel.js

readme

Demo

Demo Page

Important Note

The web audio api used by decibal.js does not currently work with IE and older releases of Firefox, Chrome, Safari, or Opera.

About

Decibal.js streamlines the importing, decoding, and playback of audio files using the Web Audio Api.

Instructions

Create an array of audio files

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}

new Decibel

create a new instance of decibel

var auido = new Decibel();

Store Decoded Files

create a var to hold the decoded files

var audioFiles;

Call the decodeAudioFiles method

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
}

playback files

once the audio files have been loaded, you can use the playback method to play the individual files

audio.playback(audioFiles.src1);

Future Objectives

  1. control facades for play, stop, rewind, fastforward
  2. effect facades for audio tracks
  3. dynamic playback controls (speed, length)
  4. track/ file selection
  5. track editing
  6. live stream facades
  7. and many more...

License

MIT

Releases

No releases published

Packages

No packages published

Languages