1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
import Tone from "tone"; let output = null; export function getOutput() { if (!output) output = makeOutput(); return output; } function makeOutput() { const compressor = new Tone.Compressor(-30, 3); const gain = new Tone.Gain(0.3); compressor.connect(gain); gain.toMaster(); return compressor; }