This is the script for legato in Kontakt 2. It is still in development, but works very well to me.
1 - Start Kontakt 2
2 - Import any legato instrument by using the import button
3 - Open up the script editor in Kontakt 2 after loading the converted .nki file
4 - Click on "Edit" and paste the script into the editor
5 - Click apply
6 - Play the instrument to see it working
7 - Save the program with script and save the script as template for other legato instruments.
here is the code to be copied in the script window:
on init
{ Used variables }
declare $time
declare $last_note
declare $interval
declare $leg_interval
declare $active_id
declare $note_count
declare $enable_legato
declare $ghost
declare $repetition
{ User Interface }
declare ui_button $VSL_GroupKeys
declare ui_value_edit $FirstLeg (0,127,1) { First Legato Keyswitch (1 semitone) }
declare ui_value_edit $NoLegKey (0,127,1) { Keyswitch for starting note }
declare ui_value_edit $RlsKey (0,127,1) { Keyswitch for released note }
declare ui_value_edit $RepKey (0,127,1) { Keyswtich for repeated/legato note }
declare ui_value_edit $RepThrs (0,5000,1) { Threshold (ms) for repeated note }
declare ui_value_edit $GhostKey (0,127,1) { Ghostkey - any key not in the playzone for
triggering a ghost note for legato }
declare ui_button $PlayZone
declare ui_value_edit $From (0,127,1) { First note of the lower octave playzone }
declare ui_value_edit $To (0,127,1) { Last note of the lower octave playzone }
declare ui_button $LegatoParam
declare ui_value_edit $Threshld (0,1000,1) { Threshold (ms) for unconnected legato }
declare ui_value_edit $Release (0,1000,1) { Release time (ms) }
move_control ($GhostKey,2,2)
move_control ($PlayZone,1,3)
move_control ($From,2,3)
move_control ($To,3,3)
move_control ($LegatoParam,4,3)
move_control ($Threshld,5,3)
move_control ($Release,6,3)
{ Fill UI with default values }
$From := 31 { G1 }
$To := 74 { D5 }
$GhostKey := 24 { C1 }
$RlsKey := 14 { D0 }
$RepKey := 13 { C#0 }
$RepThrs := 500
$NoLegKey := 15 { D#0 }
$FirstLeg := 1 { C#-1 }
{ Save UI values with patch }
make_persistent ($Threshld)
make_persistent ($Release)
make_persistent ($From)
make_persistent ($To)
make_persistent ($GhostKey)
make_persistent ($RlsKey)
make_persistent ($RepKey)
make_persistent ($RepThrs)
make_persistent ($NoLegKey)
make_persistent ($FirstLeg)
{ initialize variables }
$interval := 0
$time := 0
$note_count := 0
$ghost := 0
$repetition := 0
message(" ")
end on
on note
if ($EVENT_NOTE = $RlsKey)
exit
end if
ignore_event($EVENT_ID)
if ($EVENT_NOTE = $GhostKey)
$ghost := 1
exit
end if
if (not in_range($EVENT_NOTE,$From,$To))
exit
end if
$enable_legato := 1
if (($note_count = 0) and ($ghost = 0))
if ($time # 0)
if ($ENGINE_UPTIME - $time > $Threshld)
$enable_legato := 0
end if
else
$enable_legato := 0
end if
end if
if ($enable_legato = 1)
if ($last_note # 0)
$interval := $EVENT_NOTE - $last_note
end if
else
$interval := 0
end if
$leg_interval := abs($interval)
if ($leg_interval > 12)
$leg_interval := 12
end if
if ($leg_interval # 0)
play_note($leg_interval+$FirstLeg-1,100,0,1)
$note_count := $note_count + 1
else
if (($last_note = $EVENT_NOTE) and ($repetition = 0) and ($ENGINE_UPTIME - $time <= $RepThrs))
play_note($RepKey,100,0,1)
$repetition := 1
else
play_note($NoLegKey,100,0,1)
$repetition := 0
end if
$note_count := $note_count + 1
end if
if ($ghost # 1)
note_off ($active_id)
if ($interval >= 0)
$active_id := play_note($EVENT_NOTE,$EVENT_VELOCITY,0,-1)
$note_count := $note_count + 1
else
$active_id := play_note($EVENT_NOTE+48,$EVENT_VELOCITY,0,-1)
$note_count := $note_count + 1
end if
$ghost := 0
else
$ghost := 2
end if
$last_note := $EVENT_NOTE
$note_count := $note_count + 1
end on
on release
if ($Release # 0)
ignore_event ($EVENT_ID)
wait ($Release*500)
note_off ($EVENT_ID)
end if
dec($note_count)
if ($note_count < 0)
$note_count := 0
end if
$time := $ENGINE_UPTIME
end on
on ui_control ($PlayZone)
$PlayZone := 0
end on
on ui_control ($VSL_GroupKeys)
$VSL_GroupKeys := 0
end on
on ui_control ($LegatoParam)
$LegatoParam := 0
end on
Enjoy


Reply With Quote
Rich

Bookmarks