I’m trying to implement a resonant filter with Max Gen~ for MOD-DUO.
In order to calculate coefficients I need to access exp(x) function.
If exp() function’s argument is fixed valued Genexpr automatically substitutes the value before compiling: it works.
If exp() function’s argument is a parameter, a History or a variable, it works in Max patch but it seems not to work when LV2 plug-in is exported on mod-duo.
Is-it a bug?
How to reproduce
- copy this Genexpr code in a codebox in a Gen~ object in Max/MSP. The resonant filter works in Max/MSP.
// Resonant filter, center freq 220Hz
twopi_sr = twopi / 48000;
F_rad= 220 * twopi_sr;
BW_rad= 0.1 * twopi_sr;
// It works in Max, it desn’t in MOD-DUO
coef_b = 2 * cos(F_rad) * exp(BW_rad * -0.5);
coef_c = -exp(-BW_rad);
// Uncomment next two lines: it works on MOD-DUO because Gen~ bypass exp() function
//coef_b = 2 * cos(F_rad) * exp(0.000014 * -0.5);
//coef_c = -exp(-0.000014);
coef_a = 1 - (coef_c + coef_b);
x = in1;
y = coef_a * x + coef_b * y1 + coef_c * y2;
y2 = y1;
y1 = y;
out1 = y;
2 Export the plugin in the MOD-DUO: the filter doesn’t work.
3 Uncomment the two lines with new var assignation: filter works in Max and, when exported, now also in MOD-DUO