First time here? Check out the FAQ!

How to make an AR envelope with selectable function shapes for attack & release?

+1 vote

Rafe and I were puzzling over this one and we are not sure why this we are seeing this behavior:

If you write the Capy expression: !KeyDown true: !Value false: !Value2 in a constant and look at the scope, you see the expected output values upon KeyDown and then upon release.

If you add a soundtoglobal controller, the GeneratedEvent tracks changes to the false value via the VCS but it doesn't reflect the output values seen in the scope.  Any pointers how how to use that statement with a S2CG?


asked Apr 7, 2020 in Capytalk & Smalltalk by ben-phenix (Practitioner) (440 points)
Hi Ben & Rafe, could you please upload an example so we can see where the SoundToGlobalController is in the scheme of things? Thanks!
Hi Carla

included are two sounds, a test sound ( the constant) and  the original purpose was to use !keydown to trigger two gates, one on the !keydown and the other on the release of the !keydown.  If you peak at the the ARv3  in the gate feilds of the the two sample players I have the expression !keydown Eq: 0 and !keydown eq: 1 respectively.   What I noticed is that I had a glitch as one ramp switched to the next that lasts approx 200 samples ( 5ms)  and I suspected what was happening, was the two events where being evaluated  sequencially.  Therefor on different cycles of the capytalk process.  Ben suggested using one expression to eliminate the chance that its two events being scheduled at different times.  


When I tried his solution in a constant the !hot valuses dont change in the vcs




1 Answer

+4 votes
Best answer

Here's a variation on the concept, doing everything in the signal domain rather than pasting Capytalk expressions into Constants (which can introduce up to 1 ms delay). This Sound uses the polynomial waveshaper to raise the ramp function to selectable exponential powers (rather than using Capytalk).

answered Apr 7, 2020 by ssc (Savant) (125,050 points)
selected Apr 14, 2020 by ben-phenix
You could use the MultiWaveshaper Prototype to select the shapes from arbitrary wavetables instead.
Thanks Carla  Your polynomial version was what I was looking for and I will look into the multiwaveshaper method too.
Awesome  SSC, thanks
We do it with wavetables and MultiWaveShaper in the WireFrames library. It is very efficient.