Hi Rich, The standard library includes a function `ba.selectn <https://faust.grame.fr/doc/libraries/#ba.selectn>` that lets you choose from among parallel inputs at runtime. In your case, this would look like:
numCents = tuning : ba.selectn(numNotes, pc); All best, Cora On Sun, Oct 18, 2020 at 12:02 PM Dario Sanfilippo < sanfilippo.da...@gmail.com> wrote: > Hello, Rich. > > I believe that the problem is the selector not being known at > compile-time. I cannot think of any functions doing what you need in the > Faust libraries, from the top of my head. > > For that, perhaps something like the example code below could be helpful: > > import("stdfaust.lib"); > testlist = (10, 20, 30, 40, 50); > testsel = hslider("selector", 1, 1, 5, 1); > router(sel, list) = list : par(i, ba.count(list), * (ba.if(sel == (i + 1), > 1, 0))); > process = router(testsel, testlist); > > Best, > Dario > > > > On Sun, 18 Oct 2020 at 16:39, Rich Cochrane <rich.cochr...@bigi.org.uk> > wrote: > >> Hello again, >> >> I'm working on some basic (micro)tuning code as part of the learning >> process. I've hit a snag with something that's probably quite basic. >> >> I've implemented the tuning as an array of constant signals in parallel >> and I'm using ba.take() to grab the appropriate one for the current note, >> but it's failing at compile time with a "pattern matching error" that I'm >> struggling to interpret. Google searches suggest other people have run into >> the same problem but none of them seemed to contain a solution. >> >> A minimal (non-)working example is attached -- would anyone be kind >> enough to have a quick look and see if they can spot what's wrong? I've >> added comments indicating the key lines. >> >> Cheers, >> >> Rich >> _______________________________________________ >> 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 >
_______________________________________________ Faudiostream-users mailing list Faudiostream-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/faudiostream-users