1.0.0 • Published 9 years ago
pluck-node v1.0.0
PluckNode
PluckNode for Web Audio API
Installation
npm install pluck-nodedownloads:
API
PluckNode
constructor(audioContext, [color, decayTime])color: numbercutoff frequency (aka tone color)decayTime: numbertime until harmonics converges
Class Methods
install(): void- install
createPluck()method toAudioContext.prototypeforce
- install
Instance Attributes
frequency: AudioParamreadonlydetune: AudioParamreadonly
Instance Methods
start(when: number): voidstop(when: number): void
Usage
var pluck = new PluckNode(audioContext, 1000, 10);
pluck.frequency.value = 880;
pluck.start(audioContext.currentTime);
pluck.stop(audioContext.currentTime + 4);Install to AudioContext
At first, call install() method.
require("PluckNode").install();<script src="/path/to/pluck-node.js"></script>
<script>PluckNode.install();</script>Then, you can use createPluck(color, decayTime) method at AudioContext.
Demo
http://mohayonao.github.io/pluck-node/
Algorithm
- create OscillatorNode
- OscillatorNode connect to WaveShaperNode which has random curve
- WaveShaperNode connect to lowpass BiquadFilterNode
- when
start(), setcolorto the BiquadFilterNode frequency - and the cutoff frequency continuous change to very low frequency during
decayTime.
AudioGraph

License
MIT
1.0.0
9 years ago