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

*Yann Orlarey*
Directeur scientifique/Scientific director


orla...@grame.fr <x...@grame.fr> T : +33 (0) 4 72 07 37 00
GRAME - Centre national de création musicale
11 cours de Verdun Gensoul | 69002 Lyon
www.grame.fr | facebook <https://www.facebook.com/Gramelyon/> | instagram
<https://www.instagram.com/grame_cncm/> | twitter
<https://twitter.com/GRAME_LYON>


Le jeu. 16 juil. 2020 à 18:27, Till Bovermann <lf...@lfsaw.de> a écrit :

> 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)`, assembles an integer via a left-shift
> operation.
>
> The current version assumes a fixed input dimensionality (6, in this case):
>
> ```
> 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;
> };
>
> process = (1, 0, 0, 1, 1, 1) : dsBus2int_6;
> ```
>
> Now I'd like to write a version that takes an N-dimensional stream (N <
> 32) with the interface
>
> ```
> process = insignal : dsBus2int(N) with {
>         N = 12;
>         insignal = si.nus(N); // or something else...
> };
> ```
>
> What I need to do, is to turn the parallel composed items of `si.bus(N)`
> into a list that can be processed by the `left_shift` recursive expression
> without the step of explicitly declaring the parameter-list `x0, x1, ...`
> in the lambda expression...
>
> anyone has an idea on how to do that?
>
> all the best and thanks in advance!
>
>         Till
>
>
> --
> Till Bovermann
>
> https://tai-studio.org | http://lfsaw.de |
> https://www.instagram.com/_lfsaw/
>
>
>
>
>
>
>
>
>
>
>
>
>
> _______________________________________________
> 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