logicomacorp / WaveSabre

Official WaveSabre repository
MIT License
246 stars 34 forks source link

envelope patch for short notes #21

Closed djh0ffman closed 5 years ago

djh0ffman commented 5 years ago

while playing with one of the synths, I noticed that playing short envelopes (sustain = 0) when the sound stops, the notes are still running. for example, if you play a short pluck sound with no sustain volume but with long notes, it's still rendering all the voices even though no sound is generated.

this patch essentially sayz, if our sustain is 0.0 then when we've reached the end of the decay, we can skip to finished as release will have no affect.

double checked this with sustain of zero but slower decay and longer release and this causes the decay to be skipped early and move straight onto release on note off.

yupferris commented 5 years ago

As we discussed on slack, I don’t think we should do this change. It’s possible to build a device that can modulate sustain and we don’t want envelopes short circuiting in that case. If we want to save CPU cycles by muting voices that we know won’t output any more sound based on the amplitude envelope state, we should make that decision at a higher level where that context is known rather than changing expected envelope behavior.