grame-cncm / faust

Functional programming language for signal processing and sound synthesis
http://faust.grame.fr
Other
2.59k stars 325 forks source link

(IMPORTANT) need help bypassing an error #994

Closed discipleofbert closed 10 months ago

discipleofbert commented 10 months ago

Discussed in https://github.com/grame-cncm/faust/discussions/993

Originally posted by **discipleofbert** January 19, 2024 ok so i'm writing some code and i get an error that says that "the parameter must be a real constant numerical expression", which bothers me since i want to be able to change the parameter in real time. below is the code; the code causing the error in question is in bold... ``` declare name "whammy"; import("stdfaust.lib"); whammy = hgroup("Whammy", ef.dryWetMixer( vslider("wetAmount[style:knob]", 1, 0, 1, 0.05), ef.transpose( 1000, 10, vslider("shift (semitones)", 0, **vslider("lower", 0, -24, 24, 1)**, **vslider("upper", 0, -24, 24, 1)**, 0.01) ) ) ); process = whammy; ``` is there any way i can bypass this error and have it still work as intended? thx
DBraun commented 10 months ago

When you make a vslider for "shift (semitones)", the init, min, max, and step must be compile-time constants. Your code uses vsliders for the min and max, but sliders aren't constant. Does this code satisfy your goal?

declare name "whammy";
import("stdfaust.lib");

whammy = hgroup("Whammy", ef.dryWetMixer(vslider("wetAmount[style:knob]", 1, 0, 1, 0.05),
    ef.transpose(1000, 10,
        (vslider("shift (semitones)", 0, -24, 24, 0.01) : si.smoo)
    )
));

process = whammy;

I put a si.smoo in there too.

DBraun commented 10 months ago

Actually, let's talk more in the discussion (https://github.com/grame-cncm/faust/discussions/993) instead of this issue.