gen~ exp() function seems not to work

Description


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


  1. copy this Genexpr code in a codebox in a Gen~ object in Max/MSP. The resonant filter works in Max/MSP.

code
// Resonant filter, center freq 220Hz
History y2(0);
History y1(0);
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;
endcode

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

…maybe I wrote this topic in the wrong category.

Anyone can help me about the way I can access exp() function?
Thanks

Hi @Guido,
thank you for this detailed and useful description. Unfortunately I had no time to investigate this issue. I will have a look as soon as my time allows; not before next week.
Best
Jakob

1 Like