br1252
12-07-2005, 02:23 PM
Something I cobbled together from different things...
-- Bob
{GPO Kontrol - Kontakt 2 script Bob Richards bob@ndpcci.com
A handy little script for GPO orchestra (www.garritan.com)
mod current mod wheel setting (resets to 64 on all notes off) [cc 1]
porta current portamento setting [cc 20]
length currrent length setting [cc 21]
tune current tune setting [cc 22]
timbre current timbre setting [cc 23]
vol percentage of received midi 7 cc (volume) to apply to mod setting [cc 75]
(Remember to check Vol/Pan in Instrument Options and Auto
expr percentage of received midi 11 cc (expression) to apply to mod setting [cc 76]
vel percentage of received note velocity to apply [cc 77]
velmod percentage of received velocity to apply as mod wheel [cc 78]
timing percentage of timing delay to use for humanization [cc 25]
tuning percentage of tuning change to use for humanization [cc 26]
velocity percentage of velocity change to use for humanization [cc 27]
volume percentage of volume change to use for humanization [cc 28]
legato current legato status [cc 64]
(Remember to set the CC64 as CC only in Instrument Options)
defaults set controls to defaults
Humanize quick setting menu for different huminization settings
}
on init
declare ui_label $info1 (1,2)
set_text ($info1, "GPO: 1,20,21,22,23")
declare ui_label $info2 (1,2)
set_text ($info2, "MIDI (%): 75,76,77,78")
declare ui_label $info3 (1,2)
set_text ($info3, "Humanize (%): 25,26,27,28")
declare ui_button $legato
declare ui_knob $vol (0,100,1)
declare ui_knob $expr (0,100,1)
declare ui_knob $vel (0,100,1)
declare ui_knob $velmod (0,100,1)
declare ui_knob $mod (0,127,1)
declare ui_knob $porta (0,127,1)
declare ui_knob $length (0,127,1)
declare ui_knob $tune (0,127,1)
declare ui_knob $timbre (0,127,1)
declare ui_knob $timing (0,100,1)
declare ui_knob $tuning (0,100,1)
declare ui_knob $velocity (0,100,1)
declare ui_knob $volume (0,100,1)
declare ui_button $defaults
declare ui_menu $preset
add_menu_item ($preset,"On the spot",0)
add_menu_item ($preset,"Human touch",1)
add_menu_item ($preset,"Slight but tight",2)
add_menu_item ($preset,"Old rusty tunes",3)
add_menu_item ($preset,"Drunk driver",4)
add_menu_item ($preset,"Total desaster",5)
add_menu_item ($preset,"GPO Winds",6)
add_menu_item ($preset,"GPO Brass",7)
add_menu_item ($preset,"GPO Percussion",8)
add_menu_item ($preset,"GPO Strings",9)
move_control ($info1,1,1)
move_control ($info2,1,3)
move_control ($info3,1,5)
move_control ($vol,2,3)
move_control ($expr,3,3)
move_control ($vel,4,3)
move_control ($velmod,5,3)
move_control ($timing,2,7)
move_control ($tuning,3,7)
move_control ($velocity,4,7)
move_control ($volume,5,7)
move_control ($legato,6,3)
move_control ($defaults,6,5)
move_control ($preset,6,6)
declare $first
declare $new_time
declare $new_vel
declare $new_vol
declare $new_tune
declare $new_event
$mod:=64
$porta:= 0
$length:= 50
$tune:= 0
$timbre:= 0
$legato:=0
$vol:=0
$expr:=0
$vel:=0
$velmod:=0
$timing:=0
$velocity:=0
$tuning:=0
$volume:=0
$first:=1
make_persistent ($mod)
make_persistent ($porta)
make_persistent ($length)
make_persistent ($tune)
make_persistent ($timbre)
make_persistent ($legato)
make_persistent ($vol)
make_persistent ($expr)
make_persistent ($vel)
make_persistent ($velmod)
make_persistent ($timing)
make_persistent ($velocity)
make_persistent ($tuning)
make_persistent ($volume)
make_persistent ($preset)
message("")
end on
on note
{handle setting values after reloading instrument, but do this just once on first note recieved}
if ($first=1)
set_controller (1,$mod)
set_controller (20,$porta)
set_controller (21,$length)
set_controller (22,$tune)
set_controller (23,$timbre)
if ($legato>1)
set_controller (64,127)
else
set_controller (64,0)
end if
$first:=0
end if
{now handle note changes}
ignore_event ($EVENT_ID)
$new_time:=random (0,$timing * 1000)
$new_vel:=$EVENT_VELOCITY + (random (-127,127) * $Velocity / 200)
$new_tune := random (-1000,1000) * $tuning
$new_vol:=random (-60,60) * $volume
{set velocity and make sure it is in range}
if ($vel>1)
$new_vel:=$new_vel * $vel/100
end if
if ($new_vel>127)
$new_vel:=127
else
if ($new_vel<1)
$new_vel:=1
end if
end if
{handle mod wheel following velocity}
if ($velmod>1)
$mod:=$EVENT_VELOCITY * $velmod/100
if ($mod>127)
$mod:=127
else
if ($mod<1)
$mod:=1
end if
end if
set_controller (1,$mod)
end if
{now play the new note event}
wait($new_time+1)
$new_event:=play_note ($EVENT_NOTE,$new_vel,0,-1)
change_tune ($new_event,$new_tune,1)
change_vol ($new_event,$new_vol,1)
end on
{handle when the user interface controls are touched}
on ui_control ($mod)
set_controller (1,$mod)
end on
on ui_control ($porta)
set_controller (20,$porta)
end on
on ui_control ($length)
set_controller (21,$length)
end on
on ui_control ($tune)
set_controller (22,$tune)
end on
on ui_control ($timbre)
set_controller (23,$timbre)
end on
on ui_control ($legato)
if ($legato>1)
set_controller (64,127)
else
set_controller (64,0)
end if
end on
on ui_control ($defaults)
$mod:=64
$porta:= 0
$length:= 50
$tune:= 0
$timbre:= 0
$legato:=0
$vol:=0
$expr:=0
$vel:=0
$velmod:=0
$timing:=0
$velocity:=0
$tuning:=0
$volume:=0
$first:=1
$preset:=0
$defaults:=0
message("")
end on
on ui_control ($preset)
select ($preset)
case 0
$timing:=0
$velocity:=0
$tuning:=0
$volume:=0
$timbre:=0
$tune:=0
case 1
$timing:=10
$velocity:=5
$tuning:=15
$volume:=10
$timbre:=0
$tune:=0
case 2
$timing:=0
$velocity:=15
$tuning:=15
$volume:=20
$timbre:=0
$tune:=0
case 3
$timing:=9
$velocity:=25
$tuning:=65
$volume:=40
$timbre:=0
$tune:=0
case 4
$timing:=70
$velocity:=20
$tuning:=80
$volume:=50
$timbre:=0
$tune:=0
case 5
$timing:=100
$velocity:=100
$tuning:=100
$volume:=100
$timbre:=0
$tune:=0
case 6
$timing:=5
$velocity:=5
$tuning:=0
$volume:=5
$timbre:=5
$tune:=5
case 7
$timing:=10
$velocity:=5
$tuning:=0
$volume:=5
$timbre:=15
$tune:=10
case 8
$timing:=10
$velocity:=10
$tuning:=0
$volume:=10
$timbre:=10
$tune:=0
case 9
$timing:=5
$velocity:=5
$tuning:=0
$volume:=10
$timbre:=10
$tune:=10
end select
{force a first time init again}
$first:=1
end on
{handle the update of script knobs when external CC events are received}
on controller
if (%CC_TOUCHED[1]=1)
$mod:=%CC[1]
end if
if (%CC_TOUCHED[20]=1)
$porta:=%CC[20]
end if
if (%CC_TOUCHED[21]=1)
$length:=%CC[21]
end if
if (%CC_TOUCHED[22]=1)
$tune:=%CC[22]
end if
if (%CC_TOUCHED[23]=1)
$timbre:=%CC[23]
end if
if (%CC_TOUCHED[64]=1)
if (%CC[64]>1)
$legato:=1
else
$legato:=0
end if
end if
if (%CC_TOUCHED[25]=1)
$timing:=%CC[25] * 100 / 127
end if
if (%CC_TOUCHED[26]=1)
$tuning:=%CC[26] * 100 / 127
end if
if (%CC_TOUCHED[27]=1)
$velocity:=%CC[27] * 100 / 127
end if
if (%CC_TOUCHED[28]=1)
$volume:=%CC[28] * 100 / 127
end if
if (%CC_TOUCHED[7]=1 and $vol>0)
$mod:=%CC[7] * $vol/100
if ($mod>127)
$mod:=127
else
if ($mod<1)
$mod:=1
end if
end if
set_controller (1,$mod)
end if
if (%CC_TOUCHED[11]=1 and $expr>0)
$mod:=%CC[11] * $expr/100
if ($mod>127)
$mod:=127
else
if ($mod<1)
$mod:=1
end if
end if
set_controller (1,$mod)
end if
if (%CC_TOUCHED[75]=1)
$vol:=%CC[75] * 100 / 127
end if
if (%CC_TOUCHED[76]=1)
$expr:=%CC[76] * 100 / 127
end if
if (%CC_TOUCHED[77]=1)
$vel:=%CC[77] * 100 / 127
end if
if (%CC_TOUCHED[78]=1)
$velmod:=%CC[78] * 100 / 127
end if
{cc121 or cc123 are resets, set cc 1 back to default, also do first time init again}
if (%CC_TOUCHED[121]=1 or %CC_TOUCHED[123]=1)
$mod:=64
$first:=1
end if
end on
-- Bob
{GPO Kontrol - Kontakt 2 script Bob Richards bob@ndpcci.com
A handy little script for GPO orchestra (www.garritan.com)
mod current mod wheel setting (resets to 64 on all notes off) [cc 1]
porta current portamento setting [cc 20]
length currrent length setting [cc 21]
tune current tune setting [cc 22]
timbre current timbre setting [cc 23]
vol percentage of received midi 7 cc (volume) to apply to mod setting [cc 75]
(Remember to check Vol/Pan in Instrument Options and Auto
expr percentage of received midi 11 cc (expression) to apply to mod setting [cc 76]
vel percentage of received note velocity to apply [cc 77]
velmod percentage of received velocity to apply as mod wheel [cc 78]
timing percentage of timing delay to use for humanization [cc 25]
tuning percentage of tuning change to use for humanization [cc 26]
velocity percentage of velocity change to use for humanization [cc 27]
volume percentage of volume change to use for humanization [cc 28]
legato current legato status [cc 64]
(Remember to set the CC64 as CC only in Instrument Options)
defaults set controls to defaults
Humanize quick setting menu for different huminization settings
}
on init
declare ui_label $info1 (1,2)
set_text ($info1, "GPO: 1,20,21,22,23")
declare ui_label $info2 (1,2)
set_text ($info2, "MIDI (%): 75,76,77,78")
declare ui_label $info3 (1,2)
set_text ($info3, "Humanize (%): 25,26,27,28")
declare ui_button $legato
declare ui_knob $vol (0,100,1)
declare ui_knob $expr (0,100,1)
declare ui_knob $vel (0,100,1)
declare ui_knob $velmod (0,100,1)
declare ui_knob $mod (0,127,1)
declare ui_knob $porta (0,127,1)
declare ui_knob $length (0,127,1)
declare ui_knob $tune (0,127,1)
declare ui_knob $timbre (0,127,1)
declare ui_knob $timing (0,100,1)
declare ui_knob $tuning (0,100,1)
declare ui_knob $velocity (0,100,1)
declare ui_knob $volume (0,100,1)
declare ui_button $defaults
declare ui_menu $preset
add_menu_item ($preset,"On the spot",0)
add_menu_item ($preset,"Human touch",1)
add_menu_item ($preset,"Slight but tight",2)
add_menu_item ($preset,"Old rusty tunes",3)
add_menu_item ($preset,"Drunk driver",4)
add_menu_item ($preset,"Total desaster",5)
add_menu_item ($preset,"GPO Winds",6)
add_menu_item ($preset,"GPO Brass",7)
add_menu_item ($preset,"GPO Percussion",8)
add_menu_item ($preset,"GPO Strings",9)
move_control ($info1,1,1)
move_control ($info2,1,3)
move_control ($info3,1,5)
move_control ($vol,2,3)
move_control ($expr,3,3)
move_control ($vel,4,3)
move_control ($velmod,5,3)
move_control ($timing,2,7)
move_control ($tuning,3,7)
move_control ($velocity,4,7)
move_control ($volume,5,7)
move_control ($legato,6,3)
move_control ($defaults,6,5)
move_control ($preset,6,6)
declare $first
declare $new_time
declare $new_vel
declare $new_vol
declare $new_tune
declare $new_event
$mod:=64
$porta:= 0
$length:= 50
$tune:= 0
$timbre:= 0
$legato:=0
$vol:=0
$expr:=0
$vel:=0
$velmod:=0
$timing:=0
$velocity:=0
$tuning:=0
$volume:=0
$first:=1
make_persistent ($mod)
make_persistent ($porta)
make_persistent ($length)
make_persistent ($tune)
make_persistent ($timbre)
make_persistent ($legato)
make_persistent ($vol)
make_persistent ($expr)
make_persistent ($vel)
make_persistent ($velmod)
make_persistent ($timing)
make_persistent ($velocity)
make_persistent ($tuning)
make_persistent ($volume)
make_persistent ($preset)
message("")
end on
on note
{handle setting values after reloading instrument, but do this just once on first note recieved}
if ($first=1)
set_controller (1,$mod)
set_controller (20,$porta)
set_controller (21,$length)
set_controller (22,$tune)
set_controller (23,$timbre)
if ($legato>1)
set_controller (64,127)
else
set_controller (64,0)
end if
$first:=0
end if
{now handle note changes}
ignore_event ($EVENT_ID)
$new_time:=random (0,$timing * 1000)
$new_vel:=$EVENT_VELOCITY + (random (-127,127) * $Velocity / 200)
$new_tune := random (-1000,1000) * $tuning
$new_vol:=random (-60,60) * $volume
{set velocity and make sure it is in range}
if ($vel>1)
$new_vel:=$new_vel * $vel/100
end if
if ($new_vel>127)
$new_vel:=127
else
if ($new_vel<1)
$new_vel:=1
end if
end if
{handle mod wheel following velocity}
if ($velmod>1)
$mod:=$EVENT_VELOCITY * $velmod/100
if ($mod>127)
$mod:=127
else
if ($mod<1)
$mod:=1
end if
end if
set_controller (1,$mod)
end if
{now play the new note event}
wait($new_time+1)
$new_event:=play_note ($EVENT_NOTE,$new_vel,0,-1)
change_tune ($new_event,$new_tune,1)
change_vol ($new_event,$new_vol,1)
end on
{handle when the user interface controls are touched}
on ui_control ($mod)
set_controller (1,$mod)
end on
on ui_control ($porta)
set_controller (20,$porta)
end on
on ui_control ($length)
set_controller (21,$length)
end on
on ui_control ($tune)
set_controller (22,$tune)
end on
on ui_control ($timbre)
set_controller (23,$timbre)
end on
on ui_control ($legato)
if ($legato>1)
set_controller (64,127)
else
set_controller (64,0)
end if
end on
on ui_control ($defaults)
$mod:=64
$porta:= 0
$length:= 50
$tune:= 0
$timbre:= 0
$legato:=0
$vol:=0
$expr:=0
$vel:=0
$velmod:=0
$timing:=0
$velocity:=0
$tuning:=0
$volume:=0
$first:=1
$preset:=0
$defaults:=0
message("")
end on
on ui_control ($preset)
select ($preset)
case 0
$timing:=0
$velocity:=0
$tuning:=0
$volume:=0
$timbre:=0
$tune:=0
case 1
$timing:=10
$velocity:=5
$tuning:=15
$volume:=10
$timbre:=0
$tune:=0
case 2
$timing:=0
$velocity:=15
$tuning:=15
$volume:=20
$timbre:=0
$tune:=0
case 3
$timing:=9
$velocity:=25
$tuning:=65
$volume:=40
$timbre:=0
$tune:=0
case 4
$timing:=70
$velocity:=20
$tuning:=80
$volume:=50
$timbre:=0
$tune:=0
case 5
$timing:=100
$velocity:=100
$tuning:=100
$volume:=100
$timbre:=0
$tune:=0
case 6
$timing:=5
$velocity:=5
$tuning:=0
$volume:=5
$timbre:=5
$tune:=5
case 7
$timing:=10
$velocity:=5
$tuning:=0
$volume:=5
$timbre:=15
$tune:=10
case 8
$timing:=10
$velocity:=10
$tuning:=0
$volume:=10
$timbre:=10
$tune:=0
case 9
$timing:=5
$velocity:=5
$tuning:=0
$volume:=10
$timbre:=10
$tune:=10
end select
{force a first time init again}
$first:=1
end on
{handle the update of script knobs when external CC events are received}
on controller
if (%CC_TOUCHED[1]=1)
$mod:=%CC[1]
end if
if (%CC_TOUCHED[20]=1)
$porta:=%CC[20]
end if
if (%CC_TOUCHED[21]=1)
$length:=%CC[21]
end if
if (%CC_TOUCHED[22]=1)
$tune:=%CC[22]
end if
if (%CC_TOUCHED[23]=1)
$timbre:=%CC[23]
end if
if (%CC_TOUCHED[64]=1)
if (%CC[64]>1)
$legato:=1
else
$legato:=0
end if
end if
if (%CC_TOUCHED[25]=1)
$timing:=%CC[25] * 100 / 127
end if
if (%CC_TOUCHED[26]=1)
$tuning:=%CC[26] * 100 / 127
end if
if (%CC_TOUCHED[27]=1)
$velocity:=%CC[27] * 100 / 127
end if
if (%CC_TOUCHED[28]=1)
$volume:=%CC[28] * 100 / 127
end if
if (%CC_TOUCHED[7]=1 and $vol>0)
$mod:=%CC[7] * $vol/100
if ($mod>127)
$mod:=127
else
if ($mod<1)
$mod:=1
end if
end if
set_controller (1,$mod)
end if
if (%CC_TOUCHED[11]=1 and $expr>0)
$mod:=%CC[11] * $expr/100
if ($mod>127)
$mod:=127
else
if ($mod<1)
$mod:=1
end if
end if
set_controller (1,$mod)
end if
if (%CC_TOUCHED[75]=1)
$vol:=%CC[75] * 100 / 127
end if
if (%CC_TOUCHED[76]=1)
$expr:=%CC[76] * 100 / 127
end if
if (%CC_TOUCHED[77]=1)
$vel:=%CC[77] * 100 / 127
end if
if (%CC_TOUCHED[78]=1)
$velmod:=%CC[78] * 100 / 127
end if
{cc121 or cc123 are resets, set cc 1 back to default, also do first time init again}
if (%CC_TOUCHED[121]=1 or %CC_TOUCHED[123]=1)
$mod:=64
$first:=1
end if
end on