• Register
  • Help
Results 1 to 4 of 4

Topic: K2 script: Sforzando (+ swell) modelling

Share/Bookmark
  1. #1

    K2 script: Sforzando (+ swell) modelling

    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.

    examples:
    Normal trumpet ensemble sus patch (from VSL Opus 1)
    Trumpet ensemble played with sfz script
    Trumpet emsemble played with sfz script - "Swell" enabled
    Trumpet ensemble played with sfz script - "Swell" and "Mid_Note" enabled

    Directions:
    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.


    Code:
    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
    	message("")
    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_out($lowvelocity_id,0,0)
    	wait($attack)
    	fade_in($lowvelocity_id, $fade)
    	fade_out($EVENT_ID, $fade, 0)
    	if($Swell = 1)
    		select($Mid_Note)
    			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_out($thirdnote_id,0,0)
    				fade_in($thirdnote_id, $comeback/2)
    				fade_out($lowvelocity_id, $comeback/2, 1)
    				wait($comeback/2)
    				fade_in($EVENT_ID,$comeback/2)
    				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.

    Code:
    on init
    
    end on
    
    on note
    	wait(30000)
    	fade_out($EVENT_ID,250000,1)
    	wait(232000)
    	fade_in($EVENT_ID,4000000)
    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.

  2. #2

    Re: K2 script: Sforzando (+ swell) modelling

    ^bump^

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

    Best,
    fizbin

  3. #3

    Re: K2 script: Sforzando (+ swell) modelling

    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.

    Thankyou,
    T.S.

  4. #4

    Re: K2 script: Sforzando (+ swell) modelling

    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
    Theo Krueger - Composer

    www.TheoKrueger.com

    Kontakt 2 Scripts

Go Back to forum

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •