Hi Bart, you need to write 'y = x-1; for the second equation.

Yann

On Tue, Jun 21, 2016 at 9:01 PM, Bart Brouns <b...@magnetophon.nl> wrote:

>
> Hi Yann,
>
> Trying to understand what you wrote, I did:
>
>
> process  = x letrec {  'x = y+10;
> y = x-1; };
>
> and tried to look at the block diagram.
> The compiler (revision 6d112cfa73820c2d0080a76a1efb8499001019a8) gives me:
>
> test.dsp:2:syntax error, unexpected IDENT, expecting DELAY1 or RBRAQ
>
>
> What's going on?
>
> Cheers,
> Bart.
>
>
> On Tue, Jun 21, 2016 at 07:01:09PM +0200, Yann Orlarey wrote:
>
>> We have pushed on the master branch an experimental extension to Faust:
>> the
>> `letrec{...}` construction. It is somehow similar to `with{...}`, but for
>> _difference equations_ instead of regular definitions. It allows to easily
>> express groups of mutually recursive signals, for example `x(t)` such
>> that:
>>
>> x(t) = y(t-1)+10;
>> y(t) = x(t-1)-1;
>>
>> as:
>>
>> x letrec {  'x = y+10;
>> 'y = x-1; }
>>
>> Please remark the special notation `'x=y+10` instead of `x=y'+10`. Here
>> `'x` represents the _next value_ of `x` defined according of the _current
>> value_ of `y`. It makes syntactically impossible to write non-sensical
>> equations like `x=x+1`.
>>
>> Here is a more involved example. Let say we want to define an envelop
>> generator with an attack time, a release time and a gate signal. A
>> possible
>> definition is the following:
>>
>> ar(a,r,g) = v letrec {
>>    'n = (n+1) * (g<=g');
>>    'v = max(0, v + (n<a)/a - (n>=a)/r) * (g<=g');
>>  };
>>
>> With the following semantics for `n(t)` and `v(t)`:
>>
>> n(t) = (n(t-1)+1) * (g(t) <= g(t-1))
>> v(t) =  max(0, v(t-1)+(n(t-1)<a(t))/a(t)-(n(t-1)>=a(t))/r(t) )
>>       * (g(t)<=g(t-1))
>>
>> Tests and comments are welcome.
>>
>> Cheers
>>
>> Yann
>>
>
>
>> ------------------------------------------------------------------------------
>> Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
>> Francisco, CA to explore cutting-edge tech and listen to tech luminaries
>> present their vision of the future. This family event has something for
>> everyone, including kids. Get more information and register today.
>> http://sdm.link/attshape
>>
>
> _______________________________________________
>> Faudiostream-users mailing list
>> Faudiostream-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/faudiostream-users
>>
>
>
------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Faudiostream-users mailing list
Faudiostream-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/faudiostream-users

Reply via email to