Thursday, September 18, 2014

Key shuffler script for Kontakt

Another little Kontakt script today. This one will reorganize key-note assignments within an instrument. It can turn a pop ballad into modern atonal composition, or it can be lots of fun on drum kits. It looks like this:

Quick manual. 'Shuffle range' - here you set the range of keys to shuffle, set the lowest and highest key. To set it up quickly, use 'learn range' button, then press two keys one after another (in any order), the script will set the knob values accordingly. 'Shuffle intensity' - set how much shuffled you want keyboard to be. In one round the script takes two keys and exchange their note assignments. 'Shuffle method' - here you set the starting number for calculating key numbers to shuffle. When it's all set press 'shuffle keys' to perform the operation, or press 'restore keys' to return to 'un-shuffled' keyboard state. The shuffle is not random. It's calculated from range, intensity and method, so you can easily get back to a result you like, or you can automate shuffling in DAW. There are 1000000 possible combinations for each note range.

Here's how it works applied to one of Kontakt's factory drum machines. This machine is using 'drum computer' to create rhythms, so the notes can be shuffled. In this video I keep one rhythm pattern going while trying out different shuffle parameters.

If you like the idea, you can get the script here. It should work in Kontakt 4.2 or newer. Have fun.

Update: Revision A.

After a while of playing with drum kits, I though I would explore this idea a little further. I attempted to expand this script functionality.

First, I wanted to leave some keys out of the randomizing process. So I could e.g. have a bass drum and a snare going on, while randomizing sounds for the rest of drum pattern. I introduced two new buttons to script. 'Learn exceptions' - turn it on, now press the keys you don't want to be affected by the script, turn it off when finished. This procedure won't change the way keys are shuffled, it will just disable note properties modifications for keys in exception list. Exceptions list can be cleared any time with 'clear exceptions' button.

Another new feature is randomizing sound pitch, which can be quite fun with drums. Now every time 'shuffle keys' button is pressed, the script will create a pitch map for all keys, which will be derived from 'shuffle method' number (this is not depending on number of rounds). You can then control how much of the pitch modification to apply with 'shuffle pitch - range' knob. Also you can change pitch map polarity with the switch, mysteriously named 'pitch md. polarity'. Note that once pitch map is written, it will affect sounds also after you un-shuffle keys with 'restore' button. Pitch will be drawn from range of -24/+24 semitones. You can change maximum pitch range in the script, by editing $DETUNE_RANGE constant.

Get the expanded version of the script here.

Update 2: Small changes.

I make two small changes to the script... I have been testing its usability as a de-tuner. You can put a little life into some instruments (particularly synthetic) by de-tuning notes a little. Try this procedure: select a method number, shuffle keys, restore keys and move 'pitch range' knob just a little bit.
Some Kontakt instruments, like pianos, generate several notes, on one key stroke. It was quite disabling 'learn note range' function. As a workaround I added a condition to not to accept the same note as the second note of the range in learn function.
Another change is note range functionality, thus far it was only used when shuffle button was pressed. I added a condition, so the range is checked each time a note is played. Now you can manipulate range button while playing a shuffled keyboard, so you can automate restoring some keys original assignments and tuning.
The download link has been updated.

Update 3: Revision B.

Wouldn't it be handy, to trigger some of those buttons by a key? My controller has only knobs and sliders. Automating buttons with CC is not quite comfortable, so... Excuse me for yet another incarnation of this script. This one has 'key-learn' function for shuffle, reset and polarity buttons. They are color coded on virtual keyboard, red for shuffle, green for reset and yellow for polarity. Note that key assignments may interfere with instrument's key switches handled by other scripts, so it's best to make sure the key of choice has no other function.

Key shuffler script, revision b, download link.

1 comment:

  1. Loving this script, :-) wouldn't it be super cool to be able to store the rounds and numbers to key switches too. ie c0 Rounds 1 Number 5 etc etc.

    Great work