Re: [Faudiostream-users] How to place values in lists?
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 OpenPGP_signature Description: OpenPGP digital signature ___ Faudiostream-users mailing list Faudiostream-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/faudiostream-users
Re: [Faudiostream-users] How to place values in lists?
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 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
Re: [Faudiostream-users] How to place values in lists?
On Fri, Aug 19, 2022 at 6:23 PM Yann Orlarey wrote: > We will never thank Albert Graef enough for the black magic of pattern > matching in Faust ;-) > Thanks! So even though nobody uses Pure much these days (including myself), its pattern-matching code will survive in Faust. ;-) I was about to chime in to help resolve Robin's troubles making his design generic, but you beat me to it! -- Dr. Albert Gr"af Computer Music Research Group, JGU Mainz, Germany Email: aggr...@gmail.com, web: https://agraef.github.io/ ___ Faudiostream-users mailing list Faudiostream-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/faudiostream-users