Re: [Faudiostream-users] arbitrary channels to recursive definition?

2020-07-19 Thread Oleg Nesterov
On 07/18, Yann Orlarey wrote: > > Hi Oleg, > > Here is an implementation of apply. It's the closest I've found ;-). The > idea is to pass to the op function a list of selectors that simulate the > formal parameters but that can be created in arbitrary numbers. (Heh ;) I tried to do something

Re: [Faudiostream-users] arbitrary channels to recursive definition?

2020-07-18 Thread Yann Orlarey
Hi Oleg, Here is an implementation of apply. It's the closest I've found ;-). The idea is to pass to the op function a list of selectors that simulate the formal parameters but that can be created in arbitrary numbers. tsum((x, xs)) = sin(x)/cos(x) + tsum(xs); tsum(x) = sin(x)/cos(x);

Re: [Faudiostream-users] arbitrary channels to recursive definition?

2020-07-18 Thread Oleg Nesterov
Hi Yann, On 07/17, Yann Orlarey wrote: > > I'm not sure that answers your question, No it doesn't ;) probably I wasn't clear, please see below. > but you can do that, for instance: of course, you can always rewrite dsBus2int or anything else, but what if you do not want to change the

Re: [Faudiostream-users] arbitrary channels to recursive definition?

2020-07-17 Thread Yann Orlarey
Hi Oleg, I'm not sure that answers your question, but you can do that, for instance: dsBus2int(1) = >(0); dsBus2int(N) = dsBus2int(N-1) << 1, dsBus2int(1) :> _; encode2int(P) = P : dsBus2int(outputs(P)); process = encode2int((1,0,1,0)); Yann *Yann Orlarey* Directeur scientifique/Scientific

Re: [Faudiostream-users] arbitrary channels to recursive definition?

2020-07-17 Thread Oleg Nesterov
Hi Yann, On 07/17, Yann Orlarey wrote: > > Hi Till, > > What about : but is there a generic solution? IOW. Suppose you have a wants_list() function and a constant N. How can you turn N inputs into the N-ary list and pass it to wants_a_list ? wants_list(sig.bus(N)) won't work. Oleg.

Re: [Faudiostream-users] arbitrary channels to recursive definition?

2020-07-17 Thread Yann Orlarey
Hi Till, What about : dsBus2int(1) = _; dsBus2int(N) = dsBus2int(N-1) << 1, dsBus2int(1) :> _; Where N is the number of binary signals that you want to combine. Or, if you want to keep the comparison : dsBus2int(1) = >(0); dsBus2int(N) = dsBus2int(N-1) << 1, dsBus2int(1) :> _; Cheers Yann

Re: [Faudiostream-users] arbitrary channels to recursive definition?

2020-07-17 Thread Till Bovermann
> On 16. Jul 2020, at 20:05, Oleg Nesterov wrote: > > On 07/16, Till Bovermann wrote: >> >> import("stdfaust.lib"); >> dsBus2int_6 = si.bus(6) : \(x0, x1, x2, x3, x4, x5).(left_shift((x0, x1, x2, >> x3, x4, x5))) with { >>left_shift((x, xs)) = left_shift(xs) & ((x > 0) << 1) ; >>

Re: [Faudiostream-users] arbitrary channels to recursive definition?

2020-07-16 Thread Oleg Nesterov
On 07/16, Till Bovermann wrote: > > import("stdfaust.lib"); > dsBus2int_6 = si.bus(6) : \(x0, x1, x2, x3, x4, x5).(left_shift((x0, x1, x2, > x3, x4, x5))) with { > left_shift((x, xs)) = left_shift(xs) & ((x > 0) << 1) ; > left_shift(x) = x > 0; > }; not that it matters, but si.bus(6)

[Faudiostream-users] arbitrary channels to recursive definition?

2020-07-16 Thread Till Bovermann
Hello, I'd like to write a custom "inject" function that works on parallel input streams and turns them into a 1-dim signal (a bit like `sum` or `prod` but with a custom concatenation function). As an example, I made "dsBus2int", which, assuming a parallel binary-stream (e.g. `(1, 0, 0, 1)`,