Hi all,

Yann, thanks for giving some thought to this. Indeed, your notes are
pretty incomprehensible to me, though I do like how you write the date
:)

I don't have anything to add to Till's explanation of demand ugens in
SuperCollider, except to note that updating/requesting a new value
from a process with a trigger seems easier to implement in faust than
resetting its internal state (which seems quite non-functional).

I have been working on this and I have come up with some faust code
which I think implements correctly a couple of demand rate functions
in existing faust semantics (using ~, not control). It's quite hacky
but it does seem to work. I'm a bit busy at the moment so not sure
when I'll get a chance to finish it and write it up to the list -
possibly some time this week, possibly next.

Hope that helps,
James

On 8/5/20, Till Bovermann <lf...@lfsaw.de> wrote:
> Dear Yann,
>
>
> I can try...
>
> In SC, a demand-rate UGen graph is encapsuled into one of (currently) three
> different UGens:
>
> Demand.ar/kr  
> Duty.ar/kr
> TDuty.ar/kr
>
> Their functionality vary marginally (triggered execution/execution every
> `dur` secs, etc.).
>
> Each of them has three slots:
>
> 1. update input — either a trigger (Demand) or a Demand-rate UGen / scalar
> (duration, Duty/TDuty)
> 2. reset input — if value passes from neg to pos, reset the value stream to
> initial conditions
> 3. value stream — a Demand-rate UGen graph
>
>
> Demand-rate UGens are UGens that calculate their values every time they are
> triggered to do so from the outside, read more elaborate descriptions on
> this here:
>
>       http://doc.sccode.org/Classes/Demand.html
> and
>       http://doc.sccode.org/Classes/Duty.html
>
>
> internally, the wrapper-UGens (Demand et al) implement the following
> behavior:
>
> ```
> if reset:
>       call `next(nan)` on Demand-UGen in demand chain, this makes it reset.
> else if call for next value:
>       calculate how many values are needed for the current block (N)
>       ask for N values from demand chain by providing
> else:
>       keep last value (Demand/Duty), or 0 (TDemand)
> ```
>
>
> A demand-rate UGen with parameters in its param-slots does this if its next
> function is called:
>
> ```
> if numSamples == nan:
>       for each UGen in param-slots:
>               call `next(nan)`, this makes it reset.
>       reset myself
> else:
>       for each UGen in param-slots:
>               call next(numSamples) and collect values in array
>       compute numSample output based on parameters
> ```
>
> All relevant source code for the implementation is here:
>
> https://github.com/supercollider/supercollider/blob/develop/server/plugins/DemandUGens.cpp
>
>
> hope this helps and I did not make too many errors...
>       Till
>
> --
> Till Bovermann
>
> https://tai-studio.org | http://lfsaw.de |
> https://www.instagram.com/_lfsaw/


_______________________________________________
Faudiostream-users mailing list
Faudiostream-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/faudiostream-users

Reply via email to