1.0.0 • Published 8 years ago
pluck-node v1.0.0
PluckNode
PluckNode for Web Audio API
Installation
npm install pluck-node
downloads:
API
PluckNode
constructor(audioContext, [color, decayTime])
color: number
cutoff frequency (aka tone color)decayTime: number
time until harmonics converges
Class Methods
install(): void
- install
createPluck()
method toAudioContext.prototype
force
- install
Instance Attributes
frequency: AudioParam
readonlydetune: AudioParam
readonly
Instance Methods
start(when: number): void
stop(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()
, setcolor
to the BiquadFilterNode frequency - and the cutoff frequency continuous change to very low frequency during
decayTime
.
AudioGraph
License
MIT
1.0.0
8 years ago