Trying to understand the possibilities for Expr nodes
  • I'm trying to make a bunch of utility patches for myself to really learn Audulus.

    I keep bumping into small problems with the Expr node and I'm not sure how flexible it was designed to be.

    I usually start simple and then try different variations and approaches to see what will work. For example, this expr works, but really only does the same thing as claim( val, m, M )

    (val>M) ? M : (val < m) ? m : val

    But that sort of boolean logic makes sense, so I keep evolving it.

    I want to make a toggle (tb) button that, when on, allows incoming value (val) to pass through, unless it is out of range. If out of range, clamp the value.

    But I also want to light a red light if any clamping happens. I'm not sure how, or if it's possible to set output variables within an Expr, but here's the equation.

    (tb >= 1) ? ( ((val > M)+(val < m) >= 1) ? ( clamp(val, m, M) ) : ( val ) ) : ( 0 )

    I'll attach two example patches. The first shows several variations but none have the output for indicating clipping.
    The second patch resolves that by creating a second expression, which I'd rather avoid if possible.

    Trying something like the following doesn't result in an "error" output and allows clamping to 2.

    (t >= 1)
    ? (
    ( (val > M)+(val < m) >= 1 )
    ? ( clamp(val, m, M) + clamp(error, 1, 1) )
    : ( val )
    : ( 0 )
  • When in doubt, add parentheses.
  • My first equation works. I'm asking if it's possible to add or set a variable within the Expr to indicate an error/clipping, which would produce a 2nd output node.
  • The expression node only produces a single output which is the value of the expression. It’s not possible to set a variable.
  • Thanks for confirming.