Morph between two drawbar settings

Hey,
I just created my first script and I’m a little proud to show it to you, even though there is one problem left I couldn’t fix.

With the script you can store 2 different drawbar settings and then morph between those with a fader (or modwheel). Pretty convenient, if your midi keyboard has no faders.

(The script is based on the “Relative movement”-script - thank you @schamass!)
Organ Morph

Feel free to test it and share your experience using it.
Organ Morph Script.rackspace (390.9 KB)

The remaining problem is, that the drawbar positions of Set A and Set B aren’t stored when reopening the gigfile. Is there a solution to store these without having 2 more sets of hidden drawbar widgets?


// the widgets used
var fdr1, fdr2, fdr3, fdr4, fdr5, fdr6, fdr7, fdr8, fdr9 : widget
var button_A, button_B, button_Play, button_Copy : widget
var morph_fdr : widget

//the arrays used
faders : widget array = [fdr1, fdr2, fdr3, fdr4, fdr5, fdr6, fdr7, fdr8, fdr9]
fdr_buffers : double array = [1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0]
fdr_last : double array = [1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0]
faders_A : double array = [1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0]
faders_B : double array = [1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0]




// user function to store the actual fader position into an array
function calc_buffers ()
var i : integer
    for i=0; i<Size(fdr_buffers); i=i+1 Do
       fdr_buffers[i] = GetWidgetValue (faders[i])
    end
End


// user function to set the fader_A positions 
function set_faders_A ()
var i : integer
    for i=0; i<Size(faders_A); i=i+1 Do
        SetWidgetValue(faders[i], faders_A[i])
    end
End


// user function to set the fader_B positions 
function set_faders_B ()
var i : integer
    for i=0; i<Size(faders_B); i=i+1 Do
        SetWidgetValue(faders[i], faders_B[i])
    end
End


// user function to interpolate between position A and B
function morph_faders ()
var i : integer
    for i=0; i<Size(faders); i=i+1 Do
        SetWidgetValue(faders[i], faders_A[i]*GetWidgetValue(morph_fdr)+faders_B[i]*(1-GetWidgetValue(morph_fdr)))
    end
End


// if button_A pressed, then set all faders to the stored positions A
On WidgetValueChanged (bval : double) from button_A
    If GetWidgetValue(button_A) == 1.0 Then
        set_faders_A ()  
        SetWidgetHideOnPresentation(button_Copy, false) // un-hide button_Copy
    end 
End


// if button_B pressed, then set all faders to the stored positions B
On WidgetValueChanged (bval : double) from button_B
    If GetWidgetValue(button_B) == 1.0 Then
        set_faders_B ()
        SetWidgetHideOnPresentation(button_Copy, false) // un-hide button_Copy
    end 
End

// if button_Play pressed, then set all faders to the morphed positions
On WidgetValueChanged (bval : double) from button_Play
    If GetWidgetValue(button_Play) == 1.0 Then
        morph_faders ()
        SetWidgetHideOnPresentation(button_Copy, true) // hide button_Copy
    end 
End


// stores every fader movement depending on Play/Set A/Set B 
On WidgetValueChanged (fval : double) from fdr1, fdr2, fdr3, fdr4, fdr5, fdr6, fdr7, fdr8, fdr9
    If GetWidgetValue(button_A) == 1.0 Then
        calc_buffers ()
        faders_A = fdr_buffers  
        
    Elsif GetWidgetValue(button_B) == 1.0 Then
        calc_buffers ()
        faders_B = fdr_buffers
        
    Else calc_buffers ()
        fdr_last = fdr_buffers
    end
    
End


// if morph fader is moved, it interpolates between position A and B
On WidgetValueChanged (fval : double) from morph_fdr
    If GetWidgetValue(button_Play) == 1.0 Then
        morph_faders ()
    end
End


//Copy last fader positions in play mode to current set mode
On WidgetValueChanged (bval : double) from button_Copy
    If GetWidgetValue(button_A) == 1.0 Then
        faders_A = fdr_last
        set_faders_A()
        
    Elsif GetWidgetValue(button_B) == 1.0 Then
        faders_B = fdr_last
        set_faders_B()
    end
End

// will be executed on first use of the rackspace (or on compile)
Initialization

End

Also, I’m sure there is a way to program it more compact, but it’s my first script - feel free to optimize it!

Thank you!

6 Likes

I expanded the rackspace and the script by two sets of faders, so the A and B positions get stored permanently.
(You still set the positions with the main faders, so the small faders can be hidden - but can also serve as a visualization of the settings)
Organ Morph Script - Positions Stored.rackspace (613.1 KB)

2 Likes