[chuck-users] Can I use ADSR UGen to envelope parameters other than gain (e.g. pitch)?

Eric Heep ericheep at gmail.com
Wed Nov 1 13:36:52 EDT 2017


This might be shameless plug for a few Chugins I created, but I thought it
might be up your alley.

I made two Chugins a while back that deal with atypical envelope types, one
for power based envelopes, and one based on window functions. I enjoy using
window function envelopes for sine sweeps other types of control; here are
two short examples.


This is the power based Chugin.

PowerADSR pow => blackhole;

// envelope durations
pow.set(10::ms, 10::ms, 1.0, 10::ms);
// curves for attack, decay, and release
pow.setCurves(0.5, 2.0, 0.5);

spork ~ printValue();

pow.keyOn();
20::ms => now;
pow.keyOff();
10::ms => now;

fun void printValue() {
    while (true) {
        <<< "Power ADSR Value:", pow.value() >>>;
        1::ms => now;
    }
}


And here is the window function based Chugin.

WinFuncEnv win => dac;

// set for a Blackman window
win.setBlackman();

// envelope durations
win.attackTime(25::ms);
win.releaseTime(25::ms);

spork ~ printValue();

win.keyOn();
25::ms => now;
win.keyOff();
25::ms => now;

fun void printValue() {
    while (true) {
        <<< "Window Value:", win.windowValue() >>>;
        1::ms => now;
    }
}

On Wed, Nov 1, 2017 at 10:13 AM, Jean Menezes da Rocha <
jean at menezesdarocha.info> wrote:

> Great! That was exactly what I wanted (and suspected but couldn't figure
> out)!
>
> Thank you very much, guys!
>
> Em qua, 1 de nov de 2017 às 15:04, Mario Buoninfante <
> mario.buoninfante at gmail.com> escreveu:
>
>> Hi,
>>
>> yap, the following is a possible solution:
>>
>> Step step => ADSR adsr => SinOsc oscil => dac;
>>
>> step.next(500);
>> adsr.set(5::ms, 150::ms, 1, 500::ms);
>>
>> while(true){
>>     adsr.keyOn();
>>
>>     400::ms => now;
>>
>>     adsr.keyOff();
>>
>>     1000::ms => now;
>> }
>>
>> cheers,
>> Mario
>>
>> 2017-11-01 16:17 GMT+00:00 Michael Heuer <heuermh at gmail.com>:
>>
>>> Yes, I use the following pattern often
>>>
>>> 220.0 => float f;
>>> SinOsc osc => dac;
>>> ASDR adsr => blackhole;
>>>
>>> spork ~ updateAtSampleRate();
>>>
>>> fun void updateAtSampleRate() {
>>>   while (true) {
>>>     f + adsr.last() * f => osc.freq;
>>>     1::samp => now;
>>>   }
>>> }
>>>
>>> There is also this pattern, which tries to encapsulate the above
>>> (whatever you chuck into cv Gain(s) are provided as float parameter(s) to
>>> the tick method)
>>>
>>> https://github.com/heuermh/lick/blob/master/lick/module/Module.ck
>>> https://github.com/heuermh/lick/blob/master/examples/moduleExample.ck
>>>
>>> Cheers,
>>>
>>>    michael
>>>
>>>
>>> On Wed, Nov 1, 2017 at 11:05 AM, Jean Menezes da Rocha <
>>> jean at menezesdarocha.info> wrote:
>>>
>>>> Hello,
>>>>
>>>> the ADSR UGen, to me, seems to have effect only over amplitude (which
>>>> is its original function, I concede).
>>>> However, is there any use case where I can use ADSR to map, say, pitch
>>>> instead of amplitude, in order to avoid recurring to functions and for
>>>> loops?
>>>>
>>>> Thanks in advance!
>>>> --
>>>> Jean Menezes da Rocha
>>>> Compositor
>>>> Professor
>>>> Doutorando em Música pela Universidade Federal da Bahia
>>>>
>>>> _______________________________________________
>>>> chuck-users mailing list
>>>> chuck-users at lists.cs.princeton.edu
>>>> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>>>>
>>>>
>>>
>>> _______________________________________________
>>> chuck-users mailing list
>>> chuck-users at lists.cs.princeton.edu
>>> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>>>
>>>
>> _______________________________________________
>> chuck-users mailing list
>> chuck-users at lists.cs.princeton.edu
>> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>>
> --
> Jean Menezes da Rocha
> Compositor
> Professor
> Doutorando em Música pela Universidade Federal da Bahia
>
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20171101/e51a1fe4/attachment.html>


More information about the chuck-users mailing list