ADSR NoteOff issues

164 views
Skip to first unread message

Alberto Carlassare

unread,
Jun 16, 2016, 11:20:51 AM6/16/16
to Mozzi-users
Hi!

I'm experiencing some trouble on making ADSR working. 

1. I'm using a CONTROL_RATE ADSR.

2. I update ADSR values inside updateControl() and whne note is triggered with this code 

      MyADSR.setLevels(255,userSustain,userSustain,0);
      MyADSR.setTimes(userAttack,userDecay,20,userRelease);

If I trigger MyADSR.NoteOn the ADSR does his curve, goes to 255 in userAttack time, goes to userSustain value (0-255) in userDecay time, stay sustained during 20ms (other time if I change the value), and goes down to 0 in userRelease time. ADSR should remain at sustain value if it doesn't receive NoteOff() instruction. 

The biggest problem is when it receives NoteOff() instruction. ADSR triggers release stage but it doesn't goes to 0, It keeps hanging at a value related to the value in which ADSR was when receives NoteOff(). The final value of Relase Stage (if triggered by NoteOff(), is related to the ADSR value when Release stage is triggered thorugh NoteOff().


So mainly I've got this two issues:

1. Sustain time is just related to the SustainTime sent to the class, and is not related to the key pressure duration

2. Release stage doesn't always goes to 0 if it has been triggered throught NoteOff();


Is it possible is there any bug in the library, or most probably is some bad coding by my side?


Thanks in advance


Mr Sensorium

unread,
Jun 17, 2016, 6:53:50 AM6/17/16
to Mozzi-users
Hi Alberto,

here's a link to a fixed ADSR file, which should go to 0 at the end of the release stage.   (I need to update Mozzi when I find time...)
https://groups.google.com/d/msg/mozzi-users/TGjpth95INA/-fSy8ExWAgAJ

If you want the note to sustain 10 seconds or until released, do this:
MyADSR.setTimes(userAttack,userDecay,10000,userRelease);

The limit for each time stage is 65535 steps, an unsigned int.  The doc is here: https://sensorium.github.io/Mozzi/doc/html/class_a_d_s_r.html#a68df2fe03f1582d79e7b55e3407d474b

I hope that helps.

Tim

Alberto Carlassare

unread,
Jun 17, 2016, 8:23:25 AM6/17/16
to Mozzi-users
Yeah! Tim, thank you very much for the support! with the updated ADSR.h is working as I expected! Right now I've a complete working synth!!! Thank you, You'll be the first to knowing details when the protoype is ultimated
Reply all
Reply to author
Forward
0 new messages