X/Y PAD Morphing module

Share your ideas for improvements
Post Reply
Harmonic
Posts: 15
Joined: Wed Apr 07, 2021 9:19 pm

X/Y PAD Morphing module

Post by Harmonic » Wed Apr 21, 2021 2:06 pm

Hey Peter,

Could you please add the script we were talking about before, ?

X/Y PAD Morphing module to morph between Presets of selected parameters, something like metasurface in audiomulch, NI KORE2'S morph pad

The metasurface pad in audio mulch is much better and prefered but maybe more complex to program.

regards

Peter
Posts: 23
Joined: Thu May 09, 2019 2:21 pm

Re: X/Y PAD Morphing module

Post by Peter » Thu Apr 29, 2021 8:31 am

Why not to make use of the LUA script block and make your own custom processing block with the GUI that you like?:) The incoming v1.5.1 will contain a sample "grid" LUA script, with scalable interface and many configuration options. It should give you a nice starting point to build that.

Zrzut ekranu 2021-04-29 o 10.26.07.png
Zrzut ekranu 2021-04-29 o 10.26.07.png (29.37 KiB) Viewed 5494 times
Zrzut ekranu 2021-04-29 o 10.26.36.png
Zrzut ekranu 2021-04-29 o 10.26.36.png (102.08 KiB) Viewed 5494 times
Zrzut ekranu 2021-04-29 o 10.26.59.png
Zrzut ekranu 2021-04-29 o 10.26.59.png (20.48 KiB) Viewed 5494 times

Harmonic
Posts: 15
Joined: Wed Apr 07, 2021 9:19 pm

Re: X/Y PAD Morphing module

Post by Harmonic » Thu Apr 29, 2021 11:19 am

Why not to make use of the LUA script
my scripting knowledge isn't that good :oops:
plus you said to me that you will help me with this , please do :D

Peter
Posts: 23
Joined: Thu May 09, 2019 2:21 pm

Re: X/Y PAD Morphing module

Post by Peter » Fri Apr 30, 2021 9:08 am

Please do not over-interpret my responses because you will be ignored, not listened. I have searched through our communication and all I have replied was: "If I have time I will add another embedded LUA example with the X/Y Pad.". So yes, I will add a sample X/Y Pad LUA project, but only if/when I have time to do this (which might be in a month or 2 years period). If you don't want to wait, there's a feature (that many users have asked for) allowing you to create such "module" on your own. Basically you can start with simply drawing a rectangle and responding to mouse down/drag/up events generating two distinct parameter changes (for X and Y axes separately). All other remaining transformations (eg. triggering actual MIDI messages based on those param changes) can be done in MIDI Lab outside of the LUA Script block.

You can start with this template (it outputs parameters in range 0-1 for indexes 0 (X) and 1 (Y)):

Code: Select all

require "include/midilab"

-- placement and size
local rect_x, rect_y = 20, 40
local rect_width, rect_height = 400, 300


function plugin.processBlock(samples, smax)
end

local J = juce
local mouse = J.Point(-1,-1)
local frame = J.Rectangle_int(rect_x, rect_y, rect_width, rect_height)
local sideways = J.AffineTransform():rotated(math.pi*0.5)

params = plugin.manageParams {
	{
		name = "X";
		min = 0;
		max = 127;
		default = 0;
		changed = function(val) end;
	};
	{
		name = "Y";
		min = 0;
		max = 127;
		default = 0;
		changed = function(val) end;
	};
}


function gui.paint(g)
    g:fillAll()
    
    g:setColour(J.Colour.green)
    g:fillRect(frame)

    if (mouse.x ~= -1) then
        g:setColour(J.Colour.red)
        g:fillRect(J.Rectangle_int(mouse.x-10,mouse.y-10,20,20))
    end
    
    g:drawText("X", rect_x, rect_y + rect_height, rect_width, 20, J.Justification.centred)
    g:addTransform(sideways)
    g:drawText("Y", rect_y, -(2*rect_x + rect_width), rect_height, 20, J.Justification.centred)
end

local function mouseHandler(event)
    if not frame:contains(J.Point(event.x,event.y)) then
        return
    end
    plugin.setParameter (0, (event.x - rect_x) / rect_width)
    plugin.setParameter (1, (event.y - rect_y) / rect_height)
    
    mouse = J.Point(event.x,event.y)
    gui.getComponent():repaint()

end

local function mouseUp(event)
    if not frame:contains(J.Point(event.x,event.y)) then
        return
    end
    
    mouse = J.Point(-1,-1)
    gui.getComponent():repaint()
    
end

gui.addHandler("mouseDrag", mouseHandler)
gui.addHandler("mouseDown", mouseHandler)
gui.addHandler("mouseUp", mouseUp)

Post Reply