audiobuffer-arraybuffer-serializer
AudioBuffer serializer. Provide a serializer between AudioBuffer and ArrayBuffer.
About ArrayBuffer representation of AudioBuffer see.
Installation
Node.js
npm install audiobuffer-arraybuffer-serializer
const Encoder = require('audiobuffer-arraybuffer-serializer').Encoder;
const Decoder = require('audiobuffer-arraybuffer-serializer').Decoder;
Browser
<script src="aas.js"></script>
<script>
let encoder = new aas.Encoder();
</script>
Usage
Classes
- Encoder
- Serialize AudioBuffer to ArrayBuffer.
- Decoder
- Deserialize ArrayBuffer to AudioBuffer.
Constructor
Set littleEndian
If you want to use specified byte order
// Little endian(default)
let encoder = new Encoder();
let decoder = new Decoder();
// Little endian
let encoder = new Encoder({ littleEndian: true });
let decoder = new Decoder({ littleEndian: true });
// Big endian
let encoder = new Encoder({ littleEndian: false });
let decoder = new Decoder({ littleEndian: false });
Encode/Docode AudioBuffer/ArrayBuffer to ArrayBuffer/AudioBuffer
Simple encode/decode
let arrayBuffer = encoder.execute(audioBuffer);
let audioBuffer = decoder.execute(arrayBuffer);
Set decoded result into destination buffer.
encoder.execute(audioBuffer, arrayBuffer);
decoder.execute(arrayBuffer, audioBuffer);
Development
Build environment
npm install
Build distributed javascript file(Run unit test)
npm run test-report
Show coverage report
npm run test-browser
open ./coverage/lcov-report/index.html
For | Built file |
---|---|
node.js | ./main.js |
browser | ./aas.js |
Browser test
npm run test-report
open test/index.html
Supported browser
|Chrome|Firefox|