UNPKG

@trackr/effects-gain

Version:

A subpackage of trackr that contains gain effects.

20 lines (19 loc) 740 B
export const vibrato = (options) => { return (audioContext, eo) => { const vibratoNode = audioContext.createGain(); audioContext.createOscillator(); if (options) { if (eo.instrument instanceof OscillatorNode) { vibratoNode.gain.value = options.value; vibratoNode.connect(eo.instrument.detune); var lfo = audioContext.createOscillator(); lfo.connect(vibratoNode); lfo.frequency.value = options.frequency; lfo.start(eo.startTime); lfo.stop(eo.endTime + eo.duration); } } // eo.latestSource.connect(adsr); return vibratoNode; }; };