Hi Robin,

We will never thank Albert Graef enough for the black magic of pattern
matching in Faust ;-)

Concerning "outputs()" it is not exactly the same as "ba.count()" but it
will give the same result for a usual list of numbers (*). But "outputs()"
being primitive, based on internal information already computed by the type
system, it is, therefore, faster in terms of compilation time and doesn't
require importing any library.

Cheers,

Yann

(*)  outputs((1,2,3,4) ==  ba.count((1,2,3,4)) == 4
but outputs(((1,2),3,4) == 4   !=   ba.count(((1,2),3,4)) == 3

Le ven. 19 août 2022 à 17:05, Robin Gareus <ro...@gareus.org> a écrit :

> On 8/19/22 08:19, Yann Orlarey wrote:
> > Hi Robin,
> >
> > Here is a generic shelfcascade with an arbitrary list of frequencies. The
> > gains are directly routed. They are in the reverse order (the first input
> > is the gain of the last stage).
> >
> >
> > shelfcascade(lf) = bus(lf), ls3(first(lf)) : sc(lf) // lf : list of
> > frequencies
> > with {
> > sc((f1, f2, lf)) = bus((f2,lf)), bs3(f1,f2) : sc((f2,lf)); // recursive
> > pattern
> > sc((f1, f2)) = _, bs3(f1,f2) : hs3(f2); // halting pattern
> > bus(l) = par(i, outputs(l), _); // a bus of the size of a list
> > first((x,xs)) = x; // first element of a list
> > };
> >
>
> Hello Yann,
>
> Wow. Now that is a brilliant solution, and I have learned a few nice new
> tricks there as well. Splicing the frequency list for the halting
> pattern is something I would never have thought to do. I was too focused
> on using an iterator.
>
> Is there a reason why you have used outputs(l) instead of ba.count(l)?
>
> Thank you!
>
> --
> robin
> _______________________________________________
> 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