Skip to content

Decode array buffer data of any audio format to audio buffer

License

Notifications You must be signed in to change notification settings

tman16/audio-decode-tman16

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

audio-decode Build Status unstable Greenkeeper badge

Convert mp3/wav audio data to AudioBuffer.

npm install audio-decode

const decode = require('audio-decode');
const buffer = require('audio-lena/mp3');

//as a callback
decode(buffer, (err, audioBuffer) => {});

//as a promise
decode(buffer).then(audioBuffer => {}, err => {});

API

let promise = decode(source, {context}?, (err, audioBuffer)=>{}?)

Decode source, based on options and fire callback when done, or resolve a promise if no callback passed. Source type can be: ArrayBuffer, ArrayBufferView, Buffer, Blob, File or data-uri string.

options may include context property for web-audio-api context (browser-only). By default new audio-context is created.

Supported formats

Browser version uses decodeAudioData method, in node the aurora is used.

Shipped by default:

To enable additional format, install it as a dependency npm install --save flac.js and require once require('flac.js').

Additional formats available:

// Decode flac
let decode = require('audio-decode')
let flac = require('audio-lena/flac')
require('flac.js')

decode(flac).then(audioBuffer => {
	//buffer is ready here
})

Credits

Related

License

MIT © audiojs.

About

Decode array buffer data of any audio format to audio buffer

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%