Skip to content

Commit

Permalink
Revert "fixed envelope logic"
Browse files Browse the repository at this point in the history
This reverts commit 6571106.
  • Loading branch information
ManuLintz committed Jan 25, 2024
1 parent 6571106 commit b82a849
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions step-sequencer/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ <h2>DTMF</h2>
attackControl.addEventListener(
"input",
(ev) => {
attackTime = parseFloat(ev.target.value);
attackTime = parseInt(ev.target.value, 10);
},
false
);
Expand All @@ -226,12 +226,13 @@ <h2>DTMF</h2>
releaseControl.addEventListener(
"input",
(ev) => {
releaseTime = parseFloat(ev.target.value);
releaseTime = parseInt(ev.target.value, 10);
},
false
);

// Expose attack time & release time
const sweepLength = 2;
function playSweep(time) {
const osc = new OscillatorNode(audioCtx, {
frequency: 380,
Expand All @@ -245,12 +246,12 @@ <h2>DTMF</h2>
sweepEnv.gain.linearRampToValueAtTime(1, time + attackTime);
sweepEnv.gain.linearRampToValueAtTime(
0,
time + attackTime + releaseTime
time + sweepLength - releaseTime
);

osc.connect(sweepEnv).connect(audioCtx.destination);
osc.start(time);
osc.stop(time + attackTime + releaseTime);
osc.stop(time + sweepLength);
}

// Expose frequency & frequency modulation
Expand Down

0 comments on commit b82a849

Please sign in to comment.