LineOut.js
This is a micro-library which wraps the WebAudio API to provide a chaining interface
This library encourages intuitive functional programming, when creating a network of AudioNodes to modulate sound.
Why do I need this?
When using the native WebAudio API, you normally have to create your nodes and connect them to each other, starting with the output and ending with the input. This is how it would typically look like:
var audioContext = var envelope = audioContext envelopegainvalue = 0 envelopegain envelopegain envelope var vibrato = audioContext vibratogainvalue = 30 vibrato var lfo = audioContext lfofrequencyvalue = 5 lfostartstartTime lfo lfo var oscillator = audioContext oscillatortype = 'sawtooth' oscillatordetunevalue = 400 oscillator oscillatorstartstartTime oscillator
Using LineOut to accomplish the same thing, would look like this:
var l = l // Input generator options { nodefrequencyvalue = 5 nodestartstartTime node } options nodegainvalue = 30 // connect to it when it is created l options { nodetype = 'sawtooth' nodedetunevalue = pitch * 100 nodestartstartTime node } options { nodegainvalue = 0 nodegain nodegain } // connect to audioContext.destination
Getting Started
Install from npm
npm install lineout
Hook it up to the audio context
var LineOut = var audioContext = var lo = looptions { nodedetunevalue = 300 nodestartctxcurrentTime node}