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) above is not needed.

> 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...

Heh ;) I too tried to implement something like this but didn't find a
clean solution.

IIRC, I had to do something like

        var(1, op) = \(x1).             (op((x1)));
        var(2, op) = \(x1,x2).          (op((x1,x2)));
        var(3, op) = \(x1,x2,x3).       (op((x1,x2,x3)));
        var(4, op) = \(x1,x2,x3,x4).    (op((x1,x2,x3,x4)));
        var(5, op) = \(x1,x2,x3,x4,x5). (op((x1,x2,x3,x4,x5)));
        ...
        
        var(32,op) = ...;

now you can do

        process = insignal : var(N, dsBus2int);

as long as N is constand and <= 32.

Oleg.



_______________________________________________
Faudiostream-users mailing list
Faudiostream-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/faudiostream-users

Reply via email to