UNPKG

@trackr/effects-gain

Version:

A subpackage of trackr that contains gain effects.

23 lines (22 loc) 841 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.vibrato = void 0; exports.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; }; };