import * as Tone from "https://esm.sh/tone"; export class Lb302 { constructor(toneContext, data = {}) { this.params = data.lb302 || data || {}; // O som clássico do 303 é Sawtooth ou Square com filtro ressonante const wave = this.params.wave === 1 ? "square" : "sawtooth"; this.synth = new Tone.MonoSynth({ oscillator: { type: wave }, envelope: { attack: 0.01, decay: 0.3, sustain: 0.1, release: 0.2 }, filterEnvelope: { attack: 0.01, decay: 0.3, sustain: 0.1, release: 0.2, baseFrequency: 200, octaves: 4, exponent: 2 }, filter: { Q: 6, // Alta ressonância (o "grito" do acid) type: "lowpass", rolloff: -24 } }); this.output = this.synth; } triggerAttackRelease(note, duration, time) { // O LB302 é monofônico, mas aceita trigger normal this.synth.triggerAttackRelease(note, duration, time); } connect(dest) { this.output.connect(dest); } dispose() { this.synth.dispose(); } }