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

Attack is too fast on exponential envelope en.adsre #6

Open
jmidt opened this issue Sep 26, 2018 · 11 comments
Open

Attack is too fast on exponential envelope en.adsre #6

jmidt opened this issue Sep 26, 2018 · 11 comments

Comments

@jmidt
Copy link

jmidt commented Sep 26, 2018

When the attack time is set high on the exponential ADSR envelope, the level saturates very quickly, both not giving the wanted slow increase and also creating a long time with nothing happening before going to the decay stage. I propose something like this as a fix or a separate function

adsre_variable_attack(attT60,decT60,susLvl,relT60,gate) = envelope
  with {
  ugate = gate>0;
  samps = ugate : +~(*(ugate)); // ramp time in samples
  attSamps = int(attT60 * ma.SR);

  //The function for the attack phase. Should go from 0-1 in attSamps samples. Here it is linear
  attLvl = samps/attSamps; 

   //In the attack phase the target moves up following attLvl
  target = select2(ugate, 0.0,
           select2(samps<attSamps, (susLvl)*float(ugate), attLvl));

  //Instead of attT60, we choose some very small number, such that there is virtually no smoothing in the attack phase
  t60 = select2(ugate, relT60, select2(samps<attSamps, decT60, 0.0000001)); 

  pole = ba.tau2pole(t60/6.91);
  envelope = target : si.smooth(pole);

This gives a linear ramp up, but any function could in principle be used. I can make a pull request if you want?

@josmithiii
Copy link
Collaborator

josmithiii commented Sep 27, 2018 via email

@jmidt
Copy link
Author

jmidt commented Sep 27, 2018 via email

@jmidt
Copy link
Author

jmidt commented Sep 28, 2018 via email

@josmithiii
Copy link
Collaborator

josmithiii commented Sep 28, 2018 via email

@josmithiii
Copy link
Collaborator

josmithiii commented Sep 28, 2018 via email

@jmidt
Copy link
Author

jmidt commented Sep 28, 2018 via email

@sletz
Copy link
Member

sletz commented Sep 29, 2018

BTW, is your open-source project using Faust visible somewhere? Thanks.

@jmidt
Copy link
Author

jmidt commented Sep 29, 2018 via email

@josmithiii
Copy link
Collaborator

josmithiii commented Sep 29, 2018 via email

@jmidt
Copy link
Author

jmidt commented Sep 29, 2018 via email

@josmithiii
Copy link
Collaborator

josmithiii commented Sep 29, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants