grame-cncm / faust

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

ba.selectn is not working correctly in faust2juce #938

Closed mouseos closed 1 year ago

mouseos commented 1 year ago

I have written the following code. This code allows multiple stereo processing to be selected. This works fine in the web IDE. However, it does not function properly when compiled into juce with faust2juce. The selections made are different and cannot be switched correctly.

type=(hslider("Enhancer type[style:menu{'222A':0;'maxx':3;'multiband':5;'Off':7}]",0,0,7,2));
function1(l,r)=l,r;
function2(l,r)=l*2,r*2;
function3(l,r)=l,*3r*3;

process(l,r)=(function1(l,r),function2(l,r),function3(l,r),(l,r))<:
ba.selectn(8,type),ba.selectn(8,type+1)
sletz commented 1 year ago

The code does not compile, can you paste it in another place ?

dariosanfilippo commented 1 year ago

From the top of my head, I suggest you make sure that hslider is outputting the expected value: I remember having issues when using an integer step size on a CAQT standalone app but not on the IDE.

Dr Dario Sanfilippo http://dariosanfilippo.com

On Tue, 22 Aug 2023 at 18:36, yuu @.***> wrote:

I have written the following code. This code allows multiple stereo processing to be selected. This works fine in the web IDE. However, it does not function properly when compiled into juce with faust2juce. The selections made are different and cannot be switched correctly.

type=(hslider("Enhancer type[style:menu{'222A':0;'maxx':3;'multiband':5;'Off':7}]",0,0,7,2)); function1(l,r)=l,r; function2(l,r)=l2,r2; function3(l,r)=l,3r3;

process=(function1(l,r),function2(l,r),function3(l,r),(l,r))<: ba.selectn(8,type),ba.selectn(8,type+1)

— Reply to this email directly, view it on GitHub https://github.com/grame-cncm/faust/issues/938, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHG3I2BF6MUSV7QJE77QMS3XWTN2PANCNFSM6AAAAAA32GGYOQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

mouseos commented 1 year ago

The code does not compile, can you paste it in another place ?

sorry. It may not have been possible to compile because the code was greatly simplified due to copyright issues.

mouseos commented 1 year ago

From the top of my head, I suggest you make sure that hslider is outputting the expected value: I remember having issues when using an integer step size on a CAQT standalone app but not on the IDE. Dr Dario Sanfilippo http://dariosanfilippo.com On Tue, 22 Aug 2023 at 18:36, yuu @.> wrote: I have written the following code. This code allows multiple stereo processing to be selected. This works fine in the web IDE. However, it does not function properly when compiled into juce with faust2juce. The selections made are different and cannot be switched correctly. type=(hslider("Enhancer type[style:menu{'222A':0;'maxx':3;'multiband':5;'Off':7}]",0,0,7,2)); function1(l,r)=l,r; function2(l,r)=l2,r2; function3(l,r)=l,3r3; process=(function1(l,r),function2(l,r),function3(l,r),(l,r))<: ba.selectn(8,type),ba.selectn(8,type+1) — Reply to this email directly, view it on GitHub <#938>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHG3I2BF6MUSV7QJE77QMS3XWTN2PANCNFSM6AAAAAA32GGYOQ . You are receiving this because you are subscribed to this thread.Message ID: @.>

I'll check if hslider is working fine tomorrow.

mouseos commented 1 year ago

It turns out that my code was written incorrectly. I fixed it and it works fine. However, there seems to be a bug in the hslider.
Before the fix
type=hslider("Enhancer type[style:menu{'222A':0;'maxx':3;'multiband':5;'Off':7}]", 0, 0, 7, 2);
After modification.
type=hslider("Enhancer type[style:menu{'222A':0;'maxx':2;'multiband':4;'Off':6}]", 0, 0, 7, 2);

Running the code before the modification will output 0→2→4→8 in web ide.
However, when compiled in juce, it outputs 0→3→5→7.
I think the behaviour of the hslider in web ide is wrong.

sletz commented 1 year ago

OK kept here: https://github.com/grame-cncm/faustide/issues/78.

sletz commented 1 year ago

OK thanlks, but even with type=hslider("Enhancer type[style:menu{'222A':0;'maxx':2;'multiband':4;'Off':6}]", 0, 0, 7, 2); the value does not always change at 128 frames bouderies (rare, but happens from time to time).