• Register
  • Help
Page 1 of 15 123411 ... LastLast
Results 1 to 10 of 149

Topic: K2 portamento/glide script

Share/Bookmark
  1. #1

    K2 portamento/glide script

    This script allows a portamento pitch slide between keys. It not only changes pitch but crossfades between samples as the pitch slide occurs so that an appropriate sample is mapped to the pitch that is slid to.

    examples:
    Gliding through memories - Choir Glide (by Theodore Keuger)
    Some are to forget - Strings Glide (by Theodore Krueger)
    Desert Song - by Paul Waring

    Directions:
    1. Start Kontakt 2 and load a sus or legato type patch.
    2. Open the script editor and paste the script from below into it
    3. Hit "apply"

    The "glide" knob defines the glide time in seconds.

    The "start" knob defines the sample playback offset in seconds for all samples that are "slid to". It has no effect in dfd mode - it only works in Kontakt sampler mode.

    Scaling is the amount that the glide time increases over an octave. If it is set to 1 then the glide time is the same regardless of the interval. If it is set to 2 then every octave interval's glide time is twice the previous one. EDIT: Actually, the first octave interval is twice the glide time of no interval, the glide time for the 2nd octave interval is three times that of no interval and so forth. (thanks for pointing that out Bob) :-)

    Threshold is the interval at which scaling stops. If it is 7 (a fifth) then the glide time is no longer increased once a fifth up or down is reached as the portamento interval.


    Code:
    on init
    	declare const $pitch_change_interval := 100
    	declare $glide_on
    	declare $currentnote_id
    	declare $newnote_id
    	declare $oldnote1_id
    	declare $oldnote2_id
    	declare $oldnote3_id
    	declare $current_pitch
    	declare $target_pitch
    	declare $pitch_shift
    	declare $actual_glide
    	declare $interval_cents
    	declare polyphonic $this_id
    
    	declare ui_knob $Glide(1000, 1000000, 1000000)
    	declare ui_knob $Start (0, 1000000, 1000000)
    	declare ui_knob $Scaling(100, 200, 100)
    	declare ui_value_edit $Threshold(0, 127, 1)
    
    	$Glide := 120000
    	$Start := 5000
    	$Scaling := 125
    	$Threshold := 12
    
    	move_control($Glide, 1, 1)
    	move_control($Start, 2, 1)
    	move_control($Scaling, 3, 1)
    	move_control($Threshold, 4, 1)
    
    	make_persistent ($Start)
    	make_persistent ($Glide)
    	make_persistent ($Scaling)
    	make_persistent ($Threshold)
    
    	message("")
    end on
    
    on note
    	if ($glide_on = 1)
    		ignore_event($EVENT_ID)
    		$newnote_id := play_note($EVENT_NOTE, $EVENT_VELOCITY, $Start, -1)
    		$this_id := $newnote_id
    		change_tune($newnote_id,$current_pitch - ($EVENT_NOTE*100000), 0)
    		$target_pitch := $EVENT_NOTE * 100000
    		$interval_cents := abs($target_pitch/1000 - $current_pitch/1000)
    		if ($interval_cents > $Threshold * 100)
    			$interval_cents := $Threshold * 100
    		end if
    		$actual_glide := $Glide + ($Glide * $interval_cents / 1200 * ($Scaling - 100) / 100)
    
    		fade_out($newnote_id, 0, 1)
    		fade_in ($newnote_id,$actual_glide)
    		fade_out($currentnote_id, $actual_glide, 1)
    
    		note_off($oldnote3_id)
    		$oldnote3_id := $oldnote2_id
    		$oldnote2_id := $oldnote1_id
    		$oldnote1_id := $currentnote_id
    		$currentnote_id := $newnote_id
    
    		$pitch_shift := ($target_pitch - $current_pitch) / ($actual_glide / $pitch_change_interval)
    		wait($pitch_change_interval)
    		while(abs($target_pitch - $current_pitch) > abs($pitch_shift))
    			if ($currentnote_id = $this_id)
    				change_tune($currentnote_id, $pitch_shift, 1)
    				change_tune($oldnote1_id, $pitch_shift, 1)
    				change_tune($oldnote2_id, $pitch_shift, 1)
    				change_tune($oldnote3_id, $pitch_shift, 1)
    				$current_pitch := $current_pitch + $pitch_shift
    				wait($pitch_change_interval)
    			else
    				exit
    			end if
    		end while 
    		if ($currentnote_id = $this_id)
    			$pitch_shift := $target_pitch - $current_pitch
    			change_tune($currentnote_id, $pitch_shift, 1)
    			change_tune($oldnote1_id, $pitch_shift, 1)
    			change_tune($oldnote2_id, $pitch_shift, 1)
    			change_tune($oldnote3_id, $pitch_shift, 1)
    			$current_pitch := $target_pitch
    		end if
    	else
    		$currentnote_id := $EVENT_ID
    		$current_pitch := $EVENT_NOTE * 100000
    		$glide_on := 1
    	end if
    end on
    
    on release
    	if($EVENT_ID = $currentnote_id)
    		$glide_on := 0
    		note_off($oldnote3_id)
    		note_off($oldnote2_id)
    		note_off($oldnote1_id)
    		$current_pitch := $target_pitch
    	end if
    	if ($glide_on = 1 and $EVENT_ID # $oldnote3_id)
    		ignore_event($EVENT_ID)
    		wait($Glide)
    		note_off($EVENT_ID)
    	end if
    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 portamento/glide script

    thanks Fizbin..I`llhave to check that out when i pick up my copy on Monday...Keep Skriptin` ..Rich

  3. #3

    Re: K2 portamento/glide script

    Hi Fizbin,

    Well just to say that it is refreshing to see someone taking off into real wor with K2 - which I think to be very good - while most of us are struggling somewhat to get some basics off the ground!

    (erm...should you come across one or the other of my questions in this forum, you might have simple answers for them


    Regards
    B

  4. #4

    Re: K2 portamento/glide script

    Hey! This is excellent! I have been using it all day! Is there any chance of controlling the parameters with a CC though?

    For strings, it could be good if there was some way to chorus just during the gliss, because 20 players rarely are in perfect sync. But this is truly excellent. Bravo!

    Oh, just thought of something else. A tempo sync version would be good, where one could choose 16th, 8th, quarter note on a dial instead of fractions of a second.

    Overture 4 users should note that this will make it possible to use the gliss function to smoothly go between all chromatic samples in a long gliss. Pretty realistic!
    http://hopkins.composerarts.com

  5. #5

    Re: K2 portamento/glide script

    Many thanks for this script, Fizbin. Much appreciated. Will give it a spin when I get a chance (nursing a sick doggie right now).

    Kind regards.

  6. #6
    Senior Member Big Bob's Avatar
    Join Date
    Jun 2005
    Location
    Apple Valley, California
    Posts
    323

    Re: K2 portamento/glide script

    Thanks fizbin,

    I haven't had a chance to try it yet either, but, I'm sure it'll be another winner!

    Bob
    Big Bob (aka Wonderful Bob)

  7. #7

    Re: K2 portamento/glide script

    I thought that this had been forgotten. Someone knows how to use the forum search :-)

    This script works well with certain sources. If a sample has a slow attack (e.g. strings) it works less well. This can be corrected, I believe by fading out the first sample a little later than normal, while the second one is not faded in by script, since it has a natural fade in. I was going to add this but didn't think many were interested.

    There was another script I wrote early on that performed an artificial sforzando or sforzatto or whatever its called. That was here -> http://www.northernsounds.com/forum/...ad.php?t=33601

  8. #8
    Senior Member Big Bob's Avatar
    Join Date
    Jun 2005
    Location
    Apple Valley, California
    Posts
    323

    Re: K2 portamento/glide script

    Hey Fiz,
    Thanks for the new link, now I've got more goodies to curl up with one of these evenings.

    I was going to add this but didn't think many were interested.
    I'm glad this stuff has been 're-discovered'. You were just way ahead of your time! Keep 'em coming because I'm sure you have a much bigger audience now.

    Bob
    Big Bob (aka Wonderful Bob)

  9. #9

    Re: K2 portamento/glide script

    Quote Originally Posted by Jesse Hopkins
    Hey! This is excellent! I have been using it all day! Is there any chance of controlling the parameters with a CC though?

    For strings, it could be good if there was some way to chorus just during the gliss, because 20 players rarely are in perfect sync. But this is truly excellent. Bravo!

    Oh, just thought of something else. A tempo sync version would be good, where one could choose 16th, 8th, quarter note on a dial instead of fractions of a second.

    Overture 4 users should note that this will make it possible to use the gliss function to smoothly go between all chromatic samples in a long gliss. Pretty realistic!

    I think you could add CC control to it. The crossfade happens only during the slide. You could add tempo synch too, replacing the gliss knob values with environment variable values for the note durations. You could also add key switching to this (going back and forth between normal and portamento mode). This is just the basic version of the script.

  10. #10

    Thumbs up Re: K2 portamento/glide script

    Jay, your script is awesome! I'm new to Kontakt (arrived this week) and yesterday I've tried the portamento-script. I'm only a hobbyist but these portamento-stuff is definitely one thing I've been yearning to (tried it hardly with pitchbend and some "filling notes", but it doesn't work well and means many work for every gliding note).

    Many many thanks for the great tool and that you sharing your work with us!!

    Best regards.

Go Back to forum
Page 1 of 15 123411 ... LastLast

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
  •