Loop bug in applying envelope function

-a- from the reference it is clear that they all add up.
https://p5js.org/reference/#/p5.Envelope/setInput

-b- i try like

//...
      reset();
      env.setInput(song[i]);
      env.play();
    }
  }
}

function reset() {
  env = new p5.Envelope();
  env.setADSR(attackTime, decayTime, susPercent, releaseTime);
  env.setRange(attackLevel, releaseLevel);
}

first it looks like it is working,
but then my browser still hangs ( check on memory );

1 Like