Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sweep amplitude envelope in step sequencer #123

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions step-sequencer/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ <h2>DTMF</h2>
);

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

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

// Expose frequency & frequency modulation
Expand Down