One way is (hold a random value for n samples):

        hold (n) = aloop ~ (_,_) : (!,_) 
        with {
                        aloop (count, val1) =
                                if(count<(n), count+1, 1),              
                                if(count==n, rand, val1);               
                };

You can extend aloop(count,val1,val2,...) to output more channels in parallel.

--
Urban Schlemmer 
- Diplomtonmeister -\\
- Formation supérieure aux métiers du son (FSMS) -\\
http://chiselapp.com/user/jcage/repository/rdk
www.dsp.guru


> Gesendet: Donnerstag, 08. August 2019 um 15:21 Uhr
> Von: "Japina" <bost...@japina.eu>
> An: "Faust users" <faudiostream-users@lists.sourceforge.net>
> Betreff: [Faudiostream-users] function hold
>
> Is it possible to make the faust program hold the function instead of value? 
> I come from general purpose programming languages, so I need to change the 
> way I’m thinking of programming here :)
> 
> Here is the example script:
> 
> up_function  {}
> down_function {}
> 
> if (current_sample == 1) {
>       select down_function
> }
> 
> if (current_sample == -1) {
>       select up_function
> }
> 
> How can I do something like that in Faust?
> 
> Thanks.
> 
> B.
> 
> _______________________________________________
> 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