Dear Yann,

so here is a quick update. I managed to implement a multichannel version
of my project master_me:
https://github.com/trummerschlunk/master_me/blob/master/master_me_gui.dsp

The noise-gate example was very helpful and by understanding par,
si.bus, and signal routing in general, I could transfer the solution to
my other building blocks.

The only part, where I still rely on variables is the leveler's gating
function. I guess the code is a bit dirty too, but it works...
Feel free to optimize ;)

Thanks again to you and to the whole list <3

Klaus


On 28.07.21 09:16, Klaus Scheuermann wrote:
>
> Hi Yann!
>
> Of course it works perfectly and I learned about par, si.bus and
> ro.interleave :)
>
> Thanks... will be back soon I guess ;)
>
> Klaus
>
>
> On 27.07.21 12:17, Yann Orlarey wrote:
>> Hi Klaus,
>>
>> Thanks for the example. If I understand correctly, I think you can
>> generalize:
>>
>> gate_stereo(thresh,att,hold,rel,x,y) = ggm*x, ggm*y with {
>> ggm = gate_gain_mono(thresh,att,hold,rel,abs(x)+abs(y));
>> };
>>
>> by the following definition:
>>
>> gate_any(N,thresh,att,hold,rel) = B <: B, (B :> ggm <: B) :
>> ro.interleave(N,2) : par(i,N,*)
>> with {
>> B = si.bus(N);
>> ggm = gate_gain_mono(thresh,att,hold,rel);
>> };
>> process = gate_any(4);
>>
>> Cheers,
>>
>> Yann
>>
>>
>> Le mar. 27 juil. 2021 à 10:22, Klaus Scheuermann <kla...@posteo.de
>> <mailto:kla...@posteo.de>> a écrit :
>>
>>     Thanks Yann,
>>
>>     I am learning, but still not succeeding...
>>
>>     This is not my end-game, but maybe a good example that I can't
>>     solve...
>>
>>     How would I make an N-channel (linked) gate out of this?
>>
>>     gate_stereo(thresh,att,hold,rel,x,y)= ggm*x,ggm*ywith{
>>     ggm= gate_gain_mono(thresh,att,hold,rel,abs(x)+abs(y));
>>     };
>>     gate_gain_mono(thresh,att,hold,rel,x)=
>>     x:extendedrawgate:an.amp_follower_ar(att,rel)with{
>>     extendedrawgate(x)= max(float(rawgatesig(x)),holdsig(x));
>>     rawgatesig(x)= inlevel(x)>ba.db2linear(thresh);
>>     minrate= min(att,rel);
>>     inlevel= an.amp_follower_ar(minrate,minrate);
>>     holdcounter(x)= (max(holdreset(x)* holdsamps,_)~-(1));
>>     holdsig(x)= holdcounter(x)>0;
>>     holdreset(x)= rawgatesig(x)<rawgatesig(x)';// reset hold when raw
>>     gate falls
>>     holdsamps= int(hold*ma.SR);
>>     };
>>
>>     Thanks,
>>     Klaus
>>
>>
>>
>>
>>     On 26.07.21 16:27, Yann Orlarey wrote:
>>>     Hi Klaus,
>>>
>>>     You can give names to the input signals as in your example, but
>>>     you don't have to. In other words, instead of writing:
>>>
>>>     process(x) = f(g(x));
>>>
>>>     you can use a more idiomatic style, and write:
>>>
>>>     process = g : f;
>>>
>>>     Faust is inspired by Moses Schönfinkel's combinatory logic
>>>     (1924) and John Backus' FP (1977). The idea of Schönfinkel was
>>>     to eliminate the need for variables in mathematical logic. In
>>>     functional programming, this style is known as "point-free" or
>>>     "tacit" programming.
>>>
>>>     At first sight, it seems complicated to do without variables.
>>>     But a variable is just one way (among others) to move a value to
>>>     its point of use. In Faust, you can use the `_` and `!`
>>>     primitives, as well as the five operations of the block diagram
>>>     algebra (or the route{} primitive) to create complex routing to
>>>     move signals to their point of use.
>>>
>>>     The advantage of point-free expressions is that they are more
>>>     modular and often easier to generalize. Let say you want to
>>>     write a quadriphonic amplifier. You can write:
>>>
>>>     amp4(v,x1,x2,x3,x4) = v*x1, v*x2, v*x3, v*x4;
>>>
>>>     but it is better to write:
>>>
>>>     amp4(v) = *(v), *(v), *(v), *(v);
>>>
>>>     or even better to write:
>>>
>>>     amp4(v) =  par(c,4,*(v));
>>>
>>>     This is now easy to generalize to a variable number N of channels:
>>>
>>>     anyamp(N,v) = par(c,N,*(v)); 
>>>
>>>     (note: by convention, we use capital letters for parameters that
>>>     need to be known at compile-time, here N)
>>>
>>>     You can now specialize this general definition, as in:
>>>
>>>     amp4 = anyamp(4);
>>>     amp8 = anyamp(8);
>>>
>>>     So much for the principle, on an extremely simple example. What
>>>     you are trying to do is probably more complicated. Don't
>>>     hesitate to post a little diagram if you need help...
>>>
>>>     Cheers,
>>>
>>>
>>>     Yann
>>>
>>>
>>>     Le lun. 26 juil. 2021 à 10:23, Klaus Scheuermann
>>>     <kla...@posteo.de <mailto:kla...@posteo.de>> a écrit :
>>>
>>>         Hi All,
>>>
>>>         so for stereo, I have
>>>
>>>         process(x1,x2)= x1,x2;
>>>
>>>         How would I use 'par' in 'process' for N-channel operation?
>>>
>>>         (I need the inputs x1, x2, xN later in a function.)
>>>
>>>         Maybe a list with N entries?
>>>
>>>         Thanks, Klaus
>>>
>>>
>>>         _______________________________________________
>>>         Faudiostream-users mailing list
>>>         Faudiostream-users@lists.sourceforge.net
>>>         <mailto:Faudiostream-users@lists.sourceforge.net>
>>>         https://lists.sourceforge.net/lists/listinfo/faudiostream-users
>>>         <https://lists.sourceforge.net/lists/listinfo/faudiostream-users>
>>>
>
>
> _______________________________________________
> Faudiostream-users mailing list
> Faudiostream-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/faudiostream-users
_______________________________________________
Faudiostream-users mailing list
Faudiostream-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/faudiostream-users

Reply via email to