1.1.0 • Published 9 years ago
pluck-string-node v1.1.0
PluckStringNode
Pluck String AudioNode for Web Audio API
Installation
npm install pluck-string-nodedownloads:
API
PluckStringNode
constructor(audioContext, opts)audioContext: BaseAudioContextopts.color: numbertone color (aka cutoff frequency)opts.timeConstant: numbertime constant until harmonics converges
Instance Attributes
frequency: AudioParamreadonlydetune: AudioParamreadonlycolor: numbertimeConstant: number
Instance Methods
start(when: number): voidstop(when: number): void
Quick Example
var pluck = new PluckStringNode(audioContext);
pluck.color = 1000;
pluck.timeConstant = 10;
pluck.frequency.value = 880;
pluck.start(audioContext.currentTime);
pluck.stop(audioContext.currentTime + 4);Demo
https://mohayonao.github.io/pluck-string-node/
Algorithm
This node's algorithm is inspired from Karplus–Strong string synthesis.
- 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
timeConstant.
AudioGraph

License
MIT
1.1.0
9 years ago