0.0.2 • Published 6 years ago

audiobufferchnl v0.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
6 years ago

audiobufferchnl

audiobufferchnl = BufferSourceNode + chnl

This package extends the chnl module and adds the possibility to turn a webaudio BufferSourceNode into a chnl. This adds a lot of advantages. For further information, have a look at chnl.

audiobufferchnl is a part of the sountility collection!

Methods

Constructor

new AudioBufferChnl(audioCtx, bufferSourceNode)

To create a new instance, use the constructor like this. The first parameter audioCtx must be an AudioContext object. The second parameter bufferSourceNode must be a BufferSourceNode object.

Change the BufferSourceNode

.setBufferSourceNode(bufferSourceNode)

Accessing the BufferSourceNode

To directly gain access the BufferSourceNode object, use the bufferSourceNode field.

.bufferSourceNode

Example

const audioCtx = new AudioContext();
const buffer = audioCtx.createBuffer(2, audioCtx.sampleRate * 2.0, audioCtx.sampleRate);
const sourceNode = audioCtx.createBufferSource();
sourceNode.buffer = buffer;

const bufferChnl = new AudioBufferChnl(sourceNode, audioCtx);
// Do something with the bufferChnl
0.0.2

6 years ago

0.0.1

7 years ago