First time here? Check out the FAQ!
x

Capytalk | chaining multiple ramps in one expression

0 votes
651 views

hello,

as a capytalk practice i just try to build a capytalk version of the AR sound.

so ramp up (from 0 to 1) within the attack time is straight forward.

(!Trigger ramp: !Attack s)

and the ramp down (from 1 to 0) could be done by:

((((!Trigger turnOnAfter: !Attack s for: !Release s) ramp: !Release s) * -1) + 1)

but i have no clue how to put this 2 ramps into one script to calculate a propper ar envelope.
 

PS:

here is my awkward version, using multiple STGC sounds:

http://kyma.symbolicsound.com/qa/?qa=blob&qa_blobid=6148441695481063100

i use the resulting env in an osc sounds envelope parameter to get an idea how it sounds like. 

would be interesting to see how a more efficient version would look and sounds like. have the feeling that my version creates harmonic artefacts… maybe due the stgc overload, or it capytalk related? 

 



thanks for any insights,

johannes

asked Jan 16, 2017 in Capytalk & Smalltalk by x (Practitioner) (620 points)
edited Jan 16, 2017 by x

1 Answer

0 votes

(!Trigger ramp: !Attack s)

and the ramp down (from 1 to 0) could be done by:

((((!Trigger turnOnAfter: !Attack s for: !Release s) ramp: !Release s) * -1) + 1)
 

If you change the first expression to (!Trigger ramp00: !Attack s) then it will return to 0 after !Attack s.  Then, if you take the max of your two expressions, you will get the up-down behavior you are aiming for. So

<expr1> vmax: <expr2>

Now, regarding the artifacts you are hearing: if an amplitude envelopes is not updating at the sample rate, you will perceive quantization in the envelope as a kind of "zipper" noise (the artefacts you are hearing).

The good news is that there are multiple ways to apply an envelope that updates at the sample rate.  The Envelope parameter of the Oscillator, for example, is an audio rate parameter field (indicated by the light tan background color), so you can paste an AR or ADSR or other Sound into that field and remove the "L" to have a sample rate envelope.  

Alternatively, you can multiply any Sound by an AR (or any other Sound) to apply an amplitude envelope.  If the frequency or changing rate of one Sound is much faster than that of the other Sound, you perceive it as a (slower) amplitude envelope on the (faster) Sound.

Another trick you can use is to paste your Sound (and remove the L) into the Scale field of the AR or ADSR.  The Scale field also updates at the sample rate.

answered Jan 16, 2017 by ssc (Savant) (128,160 points)
thanks a lot for all the tips,

the basic idea i had in mind was an ar like-sound but with adjustable slopes.

i tried your "<expr1> vmax: <expr2> " attempt and with bit of adjustment it works.
but yes, at capyrate and with the "zipper" noise specially when using short attack and release times. anyway. i learned something.

thanks for clarifying, jo
just a side note: perceptually it makes more sense to use exponential slopes. you can actually make your own AR with a delayWithFeedback and some logic. Or 256 "framed"  ARs using a single delayWithFeedback ;)
hey gustl, sounds interesting. how would this "delayfeedback with logic" approach work in detail?
start with a constant using !Gate feeding a 1 samp delay. put an oscilloscope after that to see what's going on. in the delay module use 1 - !Feedback for Scale and !Feedback for feedback. In the VCS bring the feexback up to something like 0.98 and turn the gate on and off while watching the oscilloscope. it should look very familiar ;)
Essentially this is a 1pole low pass and you are filtering the gate signal. From there you can move on your own I guess. Hint: The output will never reach 1, so use some lower value to trigger the release state (for example 2 sqrt inverse)
You could also use the AR module with Exponential selected as the Type.  The slopes are controlled by AttackTime and ReleaseTime.
that's true of course! but for learning/understanding it could still be helpful. Also if you want 256 ARs in a frame you need to go this way, not sure if anyone needs that except me ;)  anyway the SciPhy synth is built this way and is a real lightweight
...