View Full Version : K2 script: Sforzando (+ swell) modelling

04-16-2005, 12:43 PM
This script attempts to model a sforzando (and optional swell) using only a normal sus or legato type patch. It does so by crossfading between samples at different velocities. In contrast with an actual played sforzando sample, it has the added benefit of being very tweakable in shaping the envelope of the note, which may allow you to create an articulation that you may not otherwise be able to employ due to the limitations of your sample set.

Normal trumpet ensemble sus patch (from VSL Opus 1) (http://www.tunefulmoon.com/mp3/sfz/tpt.mp3)
Trumpet ensemble played with sfz script (http://www.tunefulmoon.com/mp3/sfz/tpt-sfz.mp3)
Trumpet emsemble played with sfz script - "Swell" enabled (http://www.tunefulmoon.com/mp3/sfz/tpt-sfz-1.mp3)
Trumpet ensemble played with sfz script - "Swell" and "Mid_Note" enabled (http://www.tunefulmoon.com/mp3/sfz/tpt-sfz-2.mp3)

1. Start Kontakt 2 and load a sus or legato type patch, preferrably with a solid attack.
2. Open the script editor and paste the script from below into it
3. Hit "apply"

The "attack" knob defines the length of time in seconds the intial attack sustains before fading out. It is set to 5 milliseconds in the picture.

The "fade" knob defines the length of time in seconds the fade takes. It is set to 300 milliseconds in the picture.

The "low_vol" knob sets the percentage of the initial key velocity at which the lower sample will be played.

The "Swell" button enables the note swell after the intitial fade.

The "Mid_Note" button allows a third sample (whose velocity is midway between the low and high velocity samples) to be used in the crossfade during the swell. Use this only if you have 3 or more velocity layers in your patch or it will likely not make any difference.

The "pause" knob defines the length of the pause in seconds between the initial fade and the swell (i.e. the length of time playback remains at the lowest volume). Consider this "dramatic effect".

The "comeback" knob defines the number of seconds the swell takes to get back to the original volume.


on init
declare $lowvelocity_id
declare $thirdnote_id
declare $mid_vel
declare $low_vel

declare ui_knob $attack (0, 100000, 1000000)
declare ui_knob $fade (0, 1000000, 1000000)
declare ui_knob $low_vol (0, 100, 1)
declare ui_knob $pause (0, 2000000, 1000000)
declare ui_knob $comeback (0,10000000,1000000)
declare ui_button $Swell
declare ui_button $Mid_Note
move_control ($attack, 1, 1)
move_control ($fade, 2, 1)
move_control ($low_vol, 3, 1)
move_control ($Swell, 4, 1)
move_control ($Mid_Note, 4, 2)
move_control ($pause, 5, 1)
move_control ($comeback, 6, 1)
make_persistent ($attack)
make_persistent ($fade)
make_persistent ($low_vol)
make_persistent ($Swell)
make_persistent ($Mid_Note)
make_persistent ($pause)
make_persistent ($comeback)
$attack := 5000
$fade := 300000
$low_vol := 30
$pause := 750000
$comeback := 5000000
end on

on note
$low_vel := $EVENT_VELOCITY * $low_vol / 100
$mid_vel := $EVENT_VELOCITY - (($EVENT_VELOCITY - ($EVENT_VELOCITY * $low_vol / 100)) / 2)

$lowvelocity_id := play_note($EVENT_NOTE, $low_vel, 0, -1)
fade_in($lowvelocity_id, $fade)
fade_out($EVENT_ID, $fade, 0)
if($Swell = 1)
case 0
wait($fade + $pause)
fade_in($EVENT_ID, $comeback)
fade_out($lowvelocity_id, $comeback, 1)
case 1
wait($fade + $pause)
$thirdnote_id := play_note($EVENT_NOTE, $mid_vel, 0, -1)
fade_in($thirdnote_id, $comeback/2)
fade_out($lowvelocity_id, $comeback/2, 1)
fade_out($thirdnote_id, $comeback/2, 1)
end select
end if
end on

on ui_control ($Swell)
if ($Swell = 0)
$Mid_Note := 0
end if
end on

on ui_control ($Mid_Note)
if ($Swell = 0)
$Mid_Note := 0
end if
end on

...optionally, here is a very simple sfz script which uses a single velocity layer fading the note in and out as you specify. Not as convincing but maybe all you need. There is no crossfading going on. To tweak it (sorry no knobs yet) you can change the "wait" and fade in and out values til you get something you like.

on init

end on

on note
end on

You are free to use these scripts with your own samples. If you are a developer and would like to use them in your commercial library, contact me (jcoover * @ * tunefulmoon.com) and the cost to you to use them will probably be just a copy of your library :-) I am also available for custom script development.

08-23-2005, 04:24 PM

Not too many had Kontakt 2 at the time of this post. Maybe someone will find it useful.


T. S.
08-23-2005, 04:50 PM
Hi fizbin,

I haven't had a chance to try this yet but based on your examples I can sure see some real possiblities.

Can not tell you how much I appreciate you and all the rest who are contributeing so much. ;)


08-26-2005, 01:13 PM
Just read about this in your thread about the Glide script.

Sounds pretty natural with the brass - good work! I'm off to have some fun with more sounds soon.

Cool work Jay, thanks again :)