What's new

Kontakt Scripts: Add Custom Curves to Mod Wheel

Land of Missing Parts

Grumpy Monkey
Orchestral Tools Capsule has a feature that lets you draw a custom curve that remaps the mod wheel values:
Screen Shot 2019-07-27 at 11.58.18 PM.png

I am wondering if there is a way that I can do this type of thing that is based in Kontakt (rather than Capsule), and that I could apply to other non-Orchestral Tools instruments.

For instance, I know there is a factory script in Kontakt that allows me to apply a custom curve to velocity:
Screen Shot 2019-07-28 at 12.06.43 AM.png

So I'm just looking for that, but for mod wheel.
Thanks. :emoji_sunglasses:
 
It's possible, in internal with a CC Modulation .


native-instruments-kontakt-5-2690067.jpg
 
the real question would be if it's possible in multiscript, for 1.) entire multi's and 2.) for ones that dont let you edit them.
 
Here's a Multiscript version I made a while back, it can curve any incoming CC (1-127), and outputs on the same MIDI channel it came in on. You could adapt it to output all MIDI channels if you need.


Code:
on init
set_ui_height_px(250)
set_script_title("TRANSFORM CC")
declare $kbmm5 := 15
$kbmm5 := 13
declare $nqejp := 18
declare ui_label $bk2tf(2, 1)
set_text($bk2tf,"CC CURVE")
set_control_par(get_ui_id($bk2tf),$CONTROL_PAR_FONT_TYPE,$nqejp)
set_control_par(get_ui_id($bk2tf),$CONTROL_PAR_HIDE,$HIDE_PART_BG)
declare ui_value_edit $0ge5n(1, 127, 1)
set_control_par(get_ui_id($0ge5n),$CONTROL_PAR_WIDTH,32)
set_control_par(get_ui_id($0ge5n),$CONTROL_PAR_SHOW_ARROWS,0)
set_control_par(get_ui_id($0ge5n),$CONTROL_PAR_FONT_TYPE,$kbmm5)
set_control_par_str(get_ui_id($0ge5n),$CONTROL_PAR_TEXT,"")
make_persistent($0ge5n)
declare ui_label $a4e4l(2, 1)
set_text($a4e4l,"CC CHOICE")
set_control_par(get_ui_id($a4e4l),$CONTROL_PAR_FONT_TYPE,$kbmm5)
set_control_par(get_ui_id($a4e4l),$CONTROL_PAR_TEXTPOS_Y,2)
declare ui_value_edit $5f54w(0, 127, 1)
declare ui_value_edit $rsiwf(0, 127, 1)
set_control_par(get_ui_id($rsiwf),$CONTROL_PAR_WIDTH,32)
set_control_par(get_ui_id($rsiwf),$CONTROL_PAR_SHOW_ARROWS,0)
set_control_par(get_ui_id($rsiwf),$CONTROL_PAR_FONT_TYPE,$kbmm5)
set_control_par_str(get_ui_id($rsiwf),$CONTROL_PAR_TEXT,"")
set_control_par(get_ui_id($5f54w),$CONTROL_PAR_WIDTH,32)
set_control_par(get_ui_id($5f54w),$CONTROL_PAR_SHOW_ARROWS,0)
set_control_par(get_ui_id($5f54w),$CONTROL_PAR_FONT_TYPE,$kbmm5)
set_control_par_str(get_ui_id($5f54w),$CONTROL_PAR_TEXT,"")
make_persistent($5f54w)
make_persistent($rsiwf)
declare ui_label $rhbp2(2, 1)
set_text($rhbp2,"LIMIT LOW")
set_control_par(get_ui_id($rhbp2),$CONTROL_PAR_FONT_TYPE,$kbmm5)
set_control_par(get_ui_id($rhbp2),$CONTROL_PAR_TEXTPOS_Y,2)
declare ui_label $zmwhc(2, 1)
set_text($zmwhc,"LIMIT HIGH")
set_control_par(get_ui_id($zmwhc),$CONTROL_PAR_FONT_TYPE,$kbmm5)
set_control_par(get_ui_id($zmwhc),$CONTROL_PAR_TEXTPOS_Y,2)
declare ui_table %cc2kq[128](1, 4, 127)
make_persistent(%cc2kq)
declare $gl33b := 1
declare $32tkr := 1
declare $bivxc := 127
declare %sui04[128]
declare $2k2e5
$2k2e5 := 35
make_persistent($2k2e5)
declare ui_knob $dnnys(-50, 50, 1)
make_persistent($dnnys)
set_control_par(get_ui_id($dnnys),$CONTROL_PAR_DEFAULT_VALUE,0)
set_control_help($dnnys,"Adjusts velocity response curve.")
set_text($dnnys,"CURVE")
set_control_par(get_ui_id($dnnys),$CONTROL_PAR_FONT_TYPE,$kbmm5)
declare $rxejt := 0
make_persistent($rxejt)
declare $tlvhe := 64
make_persistent($tlvhe)
declare $1pl4a := 0
make_persistent($1pl4a)
declare $funvz
declare $2puhv
declare $blzdq := 1
while ($blzdq<128)
%cc2kq[$blzdq] := $blzdq
inc($blzdq)
end while
$rxejt := 0
declare %se5b2[128]
declare %hsmgx[128]
$blzdq := 0
while ($blzdq<128)
%se5b2[$blzdq] := $blzdq*100
%hsmgx[$blzdq] := $blzdq
inc($blzdq)
end while
make_persistent(%se5b2)
make_persistent(%hsmgx)
declare %w3vpl[128]
declare $gh1hf
declare %1kvc5[128]
make_persistent(%cc2kq)
make_persistent($rxejt)
make_persistent($gl33b)
make_persistent($32tkr)
make_persistent($bivxc)
declare ui_menu $hou3h
add_menu_item($hou3h,"SMOOTH",0)
add_menu_item($hou3h,"S SHAPE",1)
set_control_par(get_ui_id($hou3h),$CONTROL_PAR_TEXTPOS_Y,2)
make_persistent($hou3h)
set_control_par_str(get_ui_id($hou3h),$CONTROL_PAR_HELP,"Choose either an exponential curve or an S-shaped curve.")
set_control_par(get_ui_id($hou3h),$CONTROL_PAR_FONT_TYPE,$kbmm5)
set_control_par(get_ui_id(%cc2kq),$CONTROL_PAR_HIDE,1)
set_control_par(get_ui_id(%cc2kq),$CONTROL_PAR_BAR_COLOR,12500670)
set_control_par(get_ui_id(%cc2kq),$CONTROL_PAR_WIDTH,262)
set_control_par(get_ui_id(%cc2kq),$CONTROL_PAR_HEIGHT,120)
move_control_px(%cc2kq,222,4)
move_control_px($dnnys,390,135)
move_control_px($hou3h,391,176)
move_control_px($5f54w,308,176)
move_control_px($rsiwf,308,146)
move_control_px($rhbp2,222,176)
move_control_px($zmwhc,222,146)
move_control_px($bk2tf,70,20)
move_control_px($a4e4l,70,176)
move_control_px($0ge5n,138,176)
end on
on ui_control($5f54w)
$gl33b := $5f54w
$32tkr := $5f54w
$blzdq := 0
while ($blzdq<128)
select ($hou3h)
case 0
%cc2kq[$blzdq] := $gl33b+(%se5b2[$blzdq]*($bivxc-$gl33b)/12700)
case 1
%cc2kq[$blzdq] := $gl33b+(%sui04[$blzdq]*($bivxc-$gl33b)/12700)
end select
inc($blzdq)
end while
if ($gl33b>64)
$32tkr := 64
else
$32tkr := $gl33b
end if
$blzdq := 0
while ($blzdq<$tlvhe)
%hsmgx[$blzdq] := $32tkr+($blzdq*(64-$32tkr)/$tlvhe)
inc($blzdq)
end while
if ($1pl4a<=0)
$blzdq := $tlvhe
while ($blzdq<128)
%hsmgx[$blzdq] := 64+(($blzdq-$tlvhe)*($1pl4a+50)/50)
if (%hsmgx[$blzdq]>127)
%hsmgx[$blzdq] := 127
end if
inc($blzdq)
end while
else
$blzdq := $tlvhe
while ($blzdq<128)
%hsmgx[$blzdq] := 64+(($blzdq-$tlvhe)*51/(51-$1pl4a))
if (%hsmgx[$blzdq]>127)
%hsmgx[$blzdq] := 127
end if
inc($blzdq)
end while
end if
end on
on ui_control($rsiwf)
$bivxc := $rsiwf
select ($hou3h)
case 0
if ($dnnys>50)
$dnnys := 50
end if
$rxejt := $dnnys
$2puhv := $rxejt*-1+1000
$blzdq := 0
$funvz := 1000
$gh1hf := 0
while ($blzdq<128)
$funvz := $funvz*$2puhv/1000
%1kvc5[$blzdq] := $funvz
$gh1hf := $gh1hf+%1kvc5[$blzdq]
inc($blzdq)
end while
$blzdq := 2
%w3vpl[0] := 0
%w3vpl[1] := 0
while ($blzdq<128)
%w3vpl[$blzdq] := %w3vpl[$blzdq-1]+%1kvc5[$blzdq]
inc($blzdq)
end while
$blzdq := 0
while ($blzdq<128)
%se5b2[$blzdq] := %w3vpl[$blzdq]*128/($gh1hf/100)
inc($blzdq)
end while
$blzdq := 0
while ($blzdq<128)
%se5b2[$blzdq] := %se5b2[$blzdq]*12700/%se5b2[127]
inc($blzdq)
end while
$blzdq := 0
while ($blzdq<128)
%cc2kq[$blzdq] := $gl33b+(%se5b2[$blzdq]*($bivxc-$gl33b)/12700)
inc($blzdq)
end while
case 1
if ($dnnys>50)
$dnnys := 50
end if
$2k2e5 := $dnnys
$2puhv := $2k2e5*-1+1000
$blzdq := 0
$funvz := 1000
$gh1hf := 0
while ($blzdq<64)
$funvz := $funvz*$2puhv/1000
%1kvc5[$blzdq] := $funvz
%1kvc5[127-$blzdq] := $funvz
$gh1hf := $gh1hf+(%1kvc5[$blzdq]*2)
inc($blzdq)
end while
$blzdq := 2
%w3vpl[0] := 0
%w3vpl[1] := 0
while ($blzdq<128)
%w3vpl[$blzdq] := %w3vpl[$blzdq-1]+%1kvc5[$blzdq]
inc($blzdq)
end while
$blzdq := 0
while ($blzdq<128)
%sui04[$blzdq] := %w3vpl[$blzdq]*128/($gh1hf/100)
inc($blzdq)
end while
$blzdq := 0
while ($blzdq<128)
%sui04[$blzdq] := %sui04[$blzdq]*12700/%sui04[127]
inc($blzdq)
end while
$blzdq := 0
while ($blzdq<128)
%cc2kq[$blzdq] := $5f54w+(%sui04[$blzdq]*($rsiwf-$5f54w)/12700)
inc($blzdq)
end while
end select
end on
on ui_control($dnnys)
select ($hou3h)
case 0
if ($dnnys>50)
$dnnys := 50
end if
$rxejt := $dnnys
$2puhv := $rxejt*-1+1000
$blzdq := 0
$funvz := 1000
$gh1hf := 0
while ($blzdq<128)
$funvz := $funvz*$2puhv/1000
%1kvc5[$blzdq] := $funvz
$gh1hf := $gh1hf+%1kvc5[$blzdq]
inc($blzdq)
end while
$blzdq := 2
%w3vpl[0] := 0
%w3vpl[1] := 0
while ($blzdq<128)
%w3vpl[$blzdq] := %w3vpl[$blzdq-1]+%1kvc5[$blzdq]
inc($blzdq)
end while
$blzdq := 0
while ($blzdq<128)
%se5b2[$blzdq] := %w3vpl[$blzdq]*128/($gh1hf/100)
inc($blzdq)
end while
$blzdq := 0
while ($blzdq<128)
%se5b2[$blzdq] := %se5b2[$blzdq]*12700/%se5b2[127]
inc($blzdq)
end while
$blzdq := 0
while ($blzdq<128)
%cc2kq[$blzdq] := $gl33b+(%se5b2[$blzdq]*($bivxc-$gl33b)/12700)
inc($blzdq)
end while
case 1
if ($dnnys>50)
$dnnys := 50
end if
$2k2e5 := $dnnys
$2puhv := $2k2e5*-1+1000
$blzdq := 0
$funvz := 1000
$gh1hf := 0
while ($blzdq<64)
$funvz := $funvz*$2puhv/1000
%1kvc5[$blzdq] := $funvz
%1kvc5[127-$blzdq] := $funvz
$gh1hf := $gh1hf+(%1kvc5[$blzdq]*2)
inc($blzdq)
end while
$blzdq := 2
%w3vpl[0] := 0
%w3vpl[1] := 0
while ($blzdq<128)
%w3vpl[$blzdq] := %w3vpl[$blzdq-1]+%1kvc5[$blzdq]
inc($blzdq)
end while
$blzdq := 0
while ($blzdq<128)
%sui04[$blzdq] := %w3vpl[$blzdq]*128/($gh1hf/100)
inc($blzdq)
end while
$blzdq := 0
while ($blzdq<128)
%sui04[$blzdq] := %sui04[$blzdq]*12700/%sui04[127]
inc($blzdq)
end while
$blzdq := 0
while ($blzdq<128)
%cc2kq[$blzdq] := $5f54w+(%sui04[$blzdq]*($rsiwf-$5f54w)/12700)
inc($blzdq)
end while
end select
end on
on ui_control($hou3h)
select ($hou3h)
case 0
if ($dnnys>50)
$dnnys := 50
end if
$rxejt := $dnnys
$2puhv := $rxejt*-1+1000
$blzdq := 0
$funvz := 1000
$gh1hf := 0
while ($blzdq<128)
$funvz := $funvz*$2puhv/1000
%1kvc5[$blzdq] := $funvz
$gh1hf := $gh1hf+%1kvc5[$blzdq]
inc($blzdq)
end while
$blzdq := 2
%w3vpl[0] := 0
%w3vpl[1] := 0
while ($blzdq<128)
%w3vpl[$blzdq] := %w3vpl[$blzdq-1]+%1kvc5[$blzdq]
inc($blzdq)
end while
$blzdq := 0
while ($blzdq<128)
%se5b2[$blzdq] := %w3vpl[$blzdq]*128/($gh1hf/100)
inc($blzdq)
end while
$blzdq := 0
while ($blzdq<128)
%se5b2[$blzdq] := %se5b2[$blzdq]*12700/%se5b2[127]
inc($blzdq)
end while
$blzdq := 0
while ($blzdq<128)
%cc2kq[$blzdq] := $gl33b+(%se5b2[$blzdq]*($bivxc-$gl33b)/12700)
inc($blzdq)
end while
case 1
if ($dnnys>50)
$dnnys := 50
end if
$2k2e5 := $dnnys
$2puhv := $2k2e5*-1+1000
$blzdq := 0
$funvz := 1000
$gh1hf := 0
while ($blzdq<64)
$funvz := $funvz*$2puhv/1000
%1kvc5[$blzdq] := $funvz
%1kvc5[127-$blzdq] := $funvz
$gh1hf := $gh1hf+(%1kvc5[$blzdq]*2)
inc($blzdq)
end while
$blzdq := 2
%w3vpl[0] := 0
%w3vpl[1] := 0
while ($blzdq<128)
%w3vpl[$blzdq] := %w3vpl[$blzdq-1]+%1kvc5[$blzdq]
inc($blzdq)
end while
$blzdq := 0
while ($blzdq<128)
%sui04[$blzdq] := %w3vpl[$blzdq]*128/($gh1hf/100)
inc($blzdq)
end while
$blzdq := 0
while ($blzdq<128)
%sui04[$blzdq] := %sui04[$blzdq]*12700/%sui04[127]
inc($blzdq)
end while
$blzdq := 0
while ($blzdq<128)
%cc2kq[$blzdq] := $5f54w+(%sui04[$blzdq]*($rsiwf-$5f54w)/12700)
inc($blzdq)
end while
end select
end on
on midi_in
if ($MIDI_COMMAND=$MIDI_COMMAND_CC)
if ($MIDI_BYTE_1=$0ge5n)
ignore_midi
set_midi($MIDI_CHANNEL,$MIDI_COMMAND_CC,$0ge5n,%cc2kq[$MIDI_BYTE_2])
end if
end if
end on
 
Here's a Multiscript version I made a while back, it can curve any incoming CC (1-127), and outputs on the same MIDI channel it came in on. You could adapt it to output all MIDI channels if you need.
Thanks for this script! It works ok for shape CC's curves and it will be very useful to me, so thanks again for your work.

Here you go - I've modified the factory script so it processes mod wheel values instead of velocity.
first of all thanks for your work on this too, I would like to test your factory script mod however it gives me an error in line 277 - on release "callback type not allowed in this context" if I try to save it. I have done something wrong or there is small error in the code?

many thanks again for your time and work
 
Top Bottom