Skip to content

Commit

Permalink
Merge pull request #48 from magnetophon/adsre
Browse files Browse the repository at this point in the history
adsre: don't skip the decay phase when attack==0
  • Loading branch information
rmichon authored Oct 13, 2020
2 parents 751217f + 63afed0 commit 2d5e402
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions envelopes.lib
Original file line number Diff line number Diff line change
Expand Up @@ -297,14 +297,15 @@ adsre(attT60,decT60,susLvl,relT60,gate) = envelope with {
ugate = gate>0;
samps = ugate : +~(*(ugate)); // ramp time in samples
attSamps = int(attT60 * ma.SR);
// if attSamps==0, go straight into the decay phase
attPhase = (samps<attSamps) | (ugate:ba.impulsify);
target = select2(ugate, 0.0,
select2(samps<attSamps, (susLvl)*float(ugate), ugate));
t60 = select2(ugate, relT60, select2(samps<attSamps, decT60, attT60));
select2(attPhase, (susLvl)*float(ugate), ugate));
t60 = select2(ugate, relT60, select2(attPhase, decT60, attT60));
pole = ba.tau2pole(t60/6.91);
envelope = target : si.smooth(pole);
};


//------------------------`(en.)asre`----------------------
// ASRE (Attack, Sustain, Release) envelope generator with Exponential segments.
//
Expand Down

0 comments on commit 2d5e402

Please sign in to comment.