Running LV2 plugins in Carla on Windows11?

All your LV2 and LADSPA goodness and more.

Moderators: MattKingUSA, khz

tramp
Established Member
Posts: 2348
Joined: Mon Jul 01, 2013 8:13 am
Has thanked: 9 times
Been thanked: 468 times

Re: Running LV2 plugins in Carla on Windows11?

Post by tramp »

LinMusGuy wrote: Tue Jan 09, 2024 8:32 am

One more question: is it possible to upload additional Faust libraries into XUiDesiger? I tried to import realfaust.lib in my Faust program but than XUiDesigner failed to parse my program while without the line importing realfaust.lib it did parse my program.

This is more about how faust handle library import. Faust looks in the same path then the dsp file you load for libraries or other included dsp files. If you would make a additional library global available to faust you need to copy it to /usr/share/faust

On the road again.
User avatar
LinMusGuy
Established Member
Posts: 551
Joined: Wed Feb 27, 2019 9:33 pm
Has thanked: 22 times
Been thanked: 2 times

Re: Running LV2 plugins in Carla on Windows11?

Post by LinMusGuy »

Yes thanks. Now it works. :D

tramp
Established Member
Posts: 2348
Joined: Mon Jul 01, 2013 8:13 am
Has thanked: 9 times
Been thanked: 468 times

Re: Running LV2 plugins in Carla on Windows11?

Post by tramp »

Just found a little bug in the keyboard key matrix, just related to notes above midi key 94. Didn't know if that was related to the MIDI keyboard issue on Windows, but may be worse a try. A update will show :)

On the road again.
User avatar
LinMusGuy
Established Member
Posts: 551
Joined: Wed Feb 27, 2019 9:33 pm
Has thanked: 22 times
Been thanked: 2 times

Re: Running LV2 plugins in Carla on Windows11?

Post by LinMusGuy »

Thanks. :) I did the update, and I did a test using the dsp-file (an example from the Faust IDE with some added declarations on top) below:

Code: Select all

declare name "testsynth";
declare options "[midi:on]";
declare options "[nvoices:8]";


import("stdfaust.lib");

///////////////////////////////////////////////////////////////////////////////////////////////////
//
// Simple demo of wavetable synthesis. A LFO modulate the interpolation between 4 tables.
// It's possible to add more tables step.
//
///////////////////////////////////////////////////////////////////////////////////////////////////
// ANALOG IMPLEMENTATION:
//
// ANALOG_0	: Wave travelling
// ANALOG_1	: LFO Frequency
// ANALOG_2	: LFO Depth (wave travel modulation)
// ANALOG_3	: Release
//
// MIDI:
// CC 73	: Attack
// CC 76	: Decay
// CC 77	: Sustain
//
///////////////////////////////////////////////////////////////////////////////////////////////////
// GENERAL
midigate = button("gate");
midifreq = nentry("freq[unit:Hz]", 440, 20, 20000, 1);
midigain = nentry("gain", 0.5, 0, 1, 0.01);

waveTravel = hslider("waveTravel[BELA: ANALOG_0]",0,0,1,0.01);

// pitchwheel
bend = ba.semi2ratio(hslider("bend [midi:pitchwheel]",0,-2,2,0.01));

gFreq = midifreq * bend;

// LFO
lfoDepth = hslider("lfoDepth[BELA: ANALOG_2]",0,0.,1,0.001):si.smoo;
lfoFreq = hslider("lfoFreq[BELA: ANALOG_1]",0.1,0.01,10,0.001):si.smoo;
moov = ((os.lf_trianglepos(lfoFreq) * lfoDepth) + waveTravel) : min(1) : max(0);

volA = hslider("A[midi:ctrl 73]",0.01,0.01,4,0.01);
volD = hslider("D[midi:ctrl 76]",0.6,0.01,8,0.01);
volS = hslider("S[midi:ctrl 77]",0.2,0,1,0.01);
volR = hslider("R[BELA: ANALOG_3]",0.8,0.01,8,0.01);
envelop = en.adsre(volA,volD,volS,volR,midigate);

// Out amplitude
vol = envelop * midigain;

WF(tablesize, rang) = abs((fmod ((1+(float(ba.time)*rang)/float(tablesize)), 4.0 ))-2) -1.;

// 4 WF maxi with this version:
scanner(nb, position) = -(_,soustraction) : *(_,coef) : cos : max(0)
    with {
        coef = 3.14159 * ((nb-1)*0.5);
        soustraction = select2( position>0, 0, (position/(nb-1)) );
    };

wfosc(freq) = (rdtable(tablesize, wt1, faze)*(moov : scanner(4,0)))+(rdtable(tablesize, wt2, faze)*(moov : scanner(4,1)))
				+ (rdtable(tablesize, wt3, faze)*(moov : scanner(4,2)))+(rdtable(tablesize, wt4, faze)*(moov : scanner(4,3)))
    with {
        tablesize = 1024;
        wt1 = WF(tablesize, 16);
        wt2 = WF(tablesize, 8);
        wt3 = WF(tablesize, 6);
        wt4 = WF(tablesize, 4);
        faze = int(os.phasor(tablesize,freq));
    };

//#################################################################################################//
//##################################### EFFECT SECTION ############################################//
//#################################################################################################//
//
// Simple FX chaine build for a mono synthesizer.
// It control general volume and pan.
// FX Chaine is:
//		Drive
//		Flanger
//		Reverberation
//
// This version use ANALOG IN to controle some of the parameters.
// Other parameters continue to be available by MIDI or OSC.
//
///////////////////////////////////////////////////////////////////////////////////////////////////
// ANALOG IMPLEMENTATION:
//
// ANALOG_4	: Distortion Drive
// ANALOG_5	: Flanger Dry/Wet
// ANALOG_6	: Reverberation Dry/Wet
// ANALOG_7	: Reverberation Room size
//
// MIDI:
// CC 7	: Volume
// CC 10 : Pan
//
// CC 13 : Flanger Delay
// CC 13 : Flanger Delay
// CC 94 : Flanger Feedback
//
// CC 95 : Reverberation Damp
// CC 90 : Reverberation Stereo Width
// 
///////////////////////////////////////////////////////////////////////////////////////////////////

// VOLUME:
volFX = hslider("volume[midi:ctrl 7]",1,0,1,0.001);// Should be 7 according to MIDI CC norm.

// EFFECTS /////////////////////////////////////////////
drive = hslider("drive[BELA: ANALOG_4]",0.3,0,1,0.001);

// Flanger
curdel	= hslider("flangDel[midi:ctrl 13]",4,0.001,10,0.001);
fb = hslider("flangFeedback[midi:ctrl 94]",0.7,0,1,0.001);
fldw = hslider("dryWetFlang[BELA: ANALOG_5]",0.5,0,1,0.001);
flanger = efx
	with {
		fldel = (curdel + (os.lf_triangle(1) * 2) ) : min(10);
		efx = _ <: _, pf.flanger_mono(10,fldel,1,fb,0) : dry_wet(fldw);
	};

// Panoramic:
panno = _ : sp.panner(hslider("pan[midi:ctrl 10]",0.5,0,1,0.001)) : _,_;

// REVERB (from freeverb_demo)
reverb = _,_ <: (*(g)*fixedgain,*(g)*fixedgain :
	re.stereo_freeverb(combfeed, allpassfeed, damping, spatSpread)),
	*(1-g), *(1-g) :> _,_
    with {
        scaleroom   = 0.28;
        offsetroom  = 0.7;
        allpassfeed = 0.5;
        scaledamp   = 0.4;
        fixedgain   = 0.1;
        origSR = 44100;

    damping = vslider("Damp[midi:ctrl 95]",0.5, 0, 1, 0.025)*scaledamp*origSR/ma.SR;
    combfeed = vslider("RoomSize[BELA: ANALOG_7]", 0.7, 0, 1, 0.025)*scaleroom*origSR/ma.SR + offsetroom;
    spatSpread = vslider("Stereo[midi:ctrl 90]",0.6,0,1,0.01)*46*ma.SR/origSR;
    g = vslider("dryWetReverb[BELA: ANALOG_6]", 0.4, 0, 1, 0.001);
    // (g = Dry/Wet)
};

// Dry-Wet (from C. LEBRETON)
dry_wet(dw,x,y) = wet*y + dry*x
    with {
        wet = 0.5*(dw+1.0);
        dry = 1.0-wet;
    };

// ALL
effect = _ *(volFX) : ef.cubicnl_nodc(drive, 0.1) : flanger : panno : reverb;

process = wfosc(gFreq) * vol;

I made a simple GUI with MIDI keyboard from the dsp file in the updated XUiDesigner, and then turned it into a Windows LV2 on the Command Line. A test with the Windows LV2 plugin in Reaper on my Windows laptop showed that it's still possible to generate hanging notes, but to do so I had to move the mouse extremely fast over de plugin's GUI keyboard in Reaper.

User avatar
LinMusGuy
Established Member
Posts: 551
Joined: Wed Feb 27, 2019 9:33 pm
Has thanked: 22 times
Been thanked: 2 times

Re: Running LV2 plugins in Carla on Windows11?

Post by LinMusGuy »

A more troubling bug than the occasional hanging note is that in XUiDesigner the controllers on the plugin GUI sometimes refuse to be moved out of the frame that they have been placed in before. At other times controllers jump back to their previous position after being moved, or sometimes completely disappear from view while being moved, and are lost (from view) forever. The latter means that you will have to start building or modifying the GUI again from the previously saved json file.

tramp
Established Member
Posts: 2348
Joined: Mon Jul 01, 2013 8:13 am
Has thanked: 9 times
Been thanked: 468 times

Re: Running LV2 plugins in Carla on Windows11?

Post by tramp »

Yep, I see. I've fixed that now so moving controllers in/out of frames will be much more stable now. Also fixed that controllers cant move out of the viewing area any more.

On the road again.
User avatar
LinMusGuy
Established Member
Posts: 551
Joined: Wed Feb 27, 2019 9:33 pm
Has thanked: 22 times
Been thanked: 2 times

Re: Running LV2 plugins in Carla on Windows11?

Post by LinMusGuy »

Yes - it's much better now. :D

User avatar
LinMusGuy
Established Member
Posts: 551
Joined: Wed Feb 27, 2019 9:33 pm
Has thanked: 22 times
Been thanked: 2 times

Re: Running LV2 plugins in Carla on Windows11?

Post by LinMusGuy »

I have greatly simplified my own Faust plugin now. See:

screenshot.png
screenshot.png (219 KiB) Viewed 140482 times

Code: Select all

declare name "ChaosSynthRaw";
declare options "[midi:on]";
declare options "[nvoices:8]";


import("maths.lib");
import("reverbs.lib");
import("filters.lib");
import("stdfaust.lib");


//----------------------------Controlers------------------------------------------
freq = hslider("freq",440,20,1100,0.01);
bend = ba.semi2ratio(hslider("bending[midi:pitchwheel]",0,-50,50,0.01)) : si.smoo;
tone = 7190/(freq*bend);
gain = hslider("gain",0.5,0,1,0.0001);
gate = button("gate");
leak = 1 - hslider("leak", 0,0,0.005,0.00001);
pa = hslider("parameter", 0.6, 0.55,1,0.001);
vol = hslider("volume[scale:log]",0.1,0.0001,1,0.000001);
//-----------------------------------------------------------------------------------


//----------------------------Integrators--------------------------------------------
Integrator1 = _/tone : fi.pole(leak) ;
Integrator2 = Integrator1 : Integrator1;
Integrator3 = Integrator1 : Integrator1 : Integrator1;
In = _ <: -1*pa*Integrator1 , -1*Integrator2 , abs(Integrator3) - 1 :> _;
//------------------------------------------------------------------------------------


//-------------Loop-------------
P = _;
Q = In;
R = P ~ Q;
//------------------------------


//--------------------ADSR---------------------
att = hslider("attack", 0.01, 0, 3, 0.01);
dec = hslider("decay", 0.01, 0, 1, 0.01);
sus = hslider("sustain", 0.8, 0.1, 1, 0.01);
rel = hslider("release", 0.1, 0, 8, 0.01);
envelope = en.adsr(att,dec,sus,rel,gate)*gain;
//---------------------------------------------


//-----------------------Reverb-------------------------------
fb1 = hslider("coefficient lowpass", 0.8, 0.1, 1, 0.01);
fb2 = hslider("coefficient allpass", 0.8, 0.1, 1, 0.01);
damp = hslider("damping of the lowpass", 0.8, 0.1, 1, 0.01);
spread = hslider("spatial spread", 0, 0, 100, 1);
//------------------------------------------------------------


//-----------------------------AmplitudeCompensation---------------------------------------------
ampcomp(x) = x*tone;
// The amplitude of the generated notes drops with lower frequencies which needs compensation 
//--------------------------------------------------------------------------------------------


//-------------Volume------------------
volume(x,y) = x*vol,y*vol;
//-------------------------------------


//-------------Safety------------------
safe(x,y) = atan(x),atan(y); 
//suppression of extreme output values
//-------------------------------------


process = R : fi.dcblocker : _*envelope : ampcomp <: re.stereo_freeverb(fb1, fb2, damp, spread) : volume : safe;

It works well in the online Faust IDE (as a Faust file) and in Carla under Wine. Not the most beautiful sounds one could imagine for sure, but this is meant to be so. ;-) However in Reaper and Carla on my Windows laptop strange things happen with the created Windows LV2 plugin. The GUI is OK now, but notes are played when I hover above the plugin GUI keyboard with the mouse even without clicking, and after a while no more sounds are played.

What could be wrong here?

User avatar
LinMusGuy
Established Member
Posts: 551
Joined: Wed Feb 27, 2019 9:33 pm
Has thanked: 22 times
Been thanked: 2 times

Re: Running LV2 plugins in Carla on Windows11?

Post by LinMusGuy »

Tried again in Reaper on my Windows laptop, now notes are only played with clicking on the keys, but there many hanging notes...

User avatar
LinMusGuy
Established Member
Posts: 551
Joined: Wed Feb 27, 2019 9:33 pm
Has thanked: 22 times
Been thanked: 2 times

Re: Running LV2 plugins in Carla on Windows11?

Post by LinMusGuy »

It still sometimes happens in XUiDesigner that a controller jumps away to another position when you try to put him somewhere else.

tramp
Established Member
Posts: 2348
Joined: Mon Jul 01, 2013 8:13 am
Has thanked: 9 times
Been thanked: 468 times

Re: Running LV2 plugins in Carla on Windows11?

Post by tramp »

LinMusGuy wrote: Sat Jan 13, 2024 9:17 pm

Tried again in Reaper on my Windows laptop, now notes are only played with clicking on the keys, but there many hanging notes...

Could it be that your mouse reach the end of it's life time?
I found this one really good for fast operations:
Image
https://www.razer.com/de-de/gaming-mice ... thadder-v2

On the road again.
User avatar
LinMusGuy
Established Member
Posts: 551
Joined: Wed Feb 27, 2019 9:33 pm
Has thanked: 22 times
Been thanked: 2 times

Re: Running LV2 plugins in Carla on Windows11?

Post by LinMusGuy »

Ah - good idea! The mouse itself could also be the problem. So I have now switched the mouses of my Linux desktop computer (which is OK) and my Windows laptop to see what happens. But no - it makes no difference.

Next I will try to write a minimal Faust plugin consisting of just the bare essentials necessary for the MIDI bug in Windows Reaper to show up. Maybe that will show what's happening...?

User avatar
LinMusGuy
Established Member
Posts: 551
Joined: Wed Feb 27, 2019 9:33 pm
Has thanked: 22 times
Been thanked: 2 times

Re: Running LV2 plugins in Carla on Windows11?

Post by LinMusGuy »

Tried a third mouse, but still the same problem on my Windows laptop even when slowly moving. The problem also happens with a simple Windows LV2 with GUI keyboard based on the Faust program below:

Code: Select all

declare name "Bare";
declare options "[midi:on]";
declare options "[nvoices:8]";


import("stdfaust.lib");


//----------------------------Controlers------------------------------------------
freq = hslider("freq",440,20,1100,0.01);
//tone = 7190/(freq*bend);
gate = button("gate");
//-----------------------------------------------------------------------------------


//-------------Safety------------------
safe(x,y) = atan(x),atan(y); 
//suppression of extreme output values
//-------------------------------------


process = gate*os.lf_squarewave(freq) <: safe;
User avatar
LinMusGuy
Established Member
Posts: 551
Joined: Wed Feb 27, 2019 9:33 pm
Has thanked: 22 times
Been thanked: 2 times

Re: Running LV2 plugins in Carla on Windows11?

Post by LinMusGuy »

Did some more tests:

  • The internal instrument plugins of LMMS on my Windows laptop have no problem with hanging notes when I play their GUI keyboards with my mouse.
  • In Reaper under Wine on my Linux computer I get this:
shot.png
shot.png (88.46 KiB) Viewed 137552 times
tramp
Established Member
Posts: 2348
Joined: Mon Jul 01, 2013 8:13 am
Has thanked: 9 times
Been thanked: 468 times

Re: Running LV2 plugins in Carla on Windows11?

Post by tramp »

Could you try out Xmonk on your windows box:
https://github.com/brummer10/Xmonk.lv2

You could build it similar like the XUiDesigner plugs.
It use the same keyboard, but, feed only a single voice engine and use simple port messages for communication between GUI and engine, while the XUiDesigner based ones using atom messages.

Also the latest Fluida.lv2, could you try it. This one use the same technic as the XUiDesigner plugs but using fluidsynth as engine.
https://github.com/brummer10/Fluida.lv2

Those tests may help me to identify were exact the issue on windows comes from.

The keyboard engine is the same on Linux and windows, the only difference is that we fetch events from windows versus fetch events from Linux. Hence I'm really puzzled were the issue comes from. Somehow it seems some messages get lost, but were?

a bit more about the underlying technic LV2 uses. The GUI and the engine running in different processes. Those processes been controlled by the host loading the plugin. The GUI only communicate with the host. The host then forward the messages to the engine and versa-vie.
Now, when the MIDI keyboard didn't indicate a note-on on the keyboard, it means that the underlying ui library have fetch the mouse event correct. That's libxputyy in the case of XUiDesigner. When the event was fetched the GUI send a message to the host inform it about the event, and the host should forward the message to the engine.
There is a way to overcome this bottleneck, called instance access (That is something I usually avoid) . That allow the GUI to communicate directly with the engine. I guess we should try that to checkout if the event get lost in the plugin itself, or, if the host lost the message. All hosts have a restricted buffer for those messages, and, when it is full, no messages makes it true any-more, since the buffer was freed by send out the messages.
I may implement a option in XUiDesigner to enable instance access for testing. But for the next weeks I'm out for working, so that have to wait for a month.

On the road again.
Post Reply