Random Kontakt script
-
- KVRist
- Topic Starter
- 46 posts since 23 May, 2006
I have set up a 4 layers (groups) Kontakt instrument.
Each instrument is composed of 4 different sounds (1 sound for each of the 4 groups) that play simultaneously.
I have around 400 single sounds.
I would like to add a "random" button that when clicked randomly load different sounds in each group from the 400.
Is this something complicated?
Is there a similar script example somewhere so I can take a look?
Thanks in advance for any help, link or suggestion!
Each instrument is composed of 4 different sounds (1 sound for each of the 4 groups) that play simultaneously.
I have around 400 single sounds.
I would like to add a "random" button that when clicked randomly load different sounds in each group from the 400.
Is this something complicated?
Is there a similar script example somewhere so I can take a look?
Thanks in advance for any help, link or suggestion!
- KVRist
- 393 posts since 12 May, 2010
If I understand correctly, you have an instrument with 4 groups, each one containing about 100 sound files. If a random button is activated, you want each group to play a random sound file each time. If that's the case, this should work.
Code: Select all
on init
{ Switch declaration }
declare ui_switch $make_it_random
end on
on note
{ If the random switch is activated }
if ($make_it_random=1)
{ Ignore the note and disallow all groups }
ignore_event($EVENT_ID)
disallow_group($ALL_GROUPS)
{ Allow first group and play a random note between 0 and 127 (entire range, change this if necessary), then disallow the group }
allow_group(0)
play_note(random(0,127),$EVENT_VELOCITY,0,-1)
disallow_group(0)
{ Same for the second group }
allow_group(1)
play_note(random(0,127),$EVENT_VELOCITY,0,-1)
disallow_group(1)
{ Same for the third group }
allow_group(2)
play_note(random(0,127),$EVENT_VELOCITY,0,-1)
disallow_group(2)
{ Same for the fourth group }
allow_group(3)
play_note(random(0,127),$EVENT_VELOCITY,0,-1)
disallow_group(3)
end if
end on
- Wavesfactory.
https://www.wavesfactory.com
https://www.wavesfactory.com
-
- KVRist
- Topic Starter
- 46 posts since 23 May, 2006
Hi thanks for the help.
Sorry I have explained my case in the wrong way.
The main instrument engine is a simple 4 groups instrument.
Is a PAD type of instrument, in each group there is a different PAD sound.
When you play the instrument you play simoulatnesly the four groups in order to have a big PAD sound.
The main engine instrument when opened is empty .
In the "Instrument" folder (along with the empty "main engine" instrument) I have 400 1 group PAD instruments.
These 400 instruments are "basic" kontakt instruments with no script, just the PAD sound loaded in Group 1.
What I would like to do is add in the main engine instrument a random button that when clicked randomly load (reading from the 400 single pad instruments) a different PAD sound in each one of the 4 groups.
For example :
Main engine : empty 4 group instrument
In the instrument folder I have 10 single (1 group) PAD instruments (PAD 1, PAD 2 etc etc.)
When I hit the "random" button the main engine randomly load one single PAD instrument in each of the 4 groups.
So for example I will have : PAD 1 in Group1 - PAD 10 in Group2 - PAD 5 in Group3 - PAD 7 in Group4.
It's something possible?
Thanks in advance for any help!
Sorry I have explained my case in the wrong way.
The main instrument engine is a simple 4 groups instrument.
Is a PAD type of instrument, in each group there is a different PAD sound.
When you play the instrument you play simoulatnesly the four groups in order to have a big PAD sound.
The main engine instrument when opened is empty .
In the "Instrument" folder (along with the empty "main engine" instrument) I have 400 1 group PAD instruments.
These 400 instruments are "basic" kontakt instruments with no script, just the PAD sound loaded in Group 1.
What I would like to do is add in the main engine instrument a random button that when clicked randomly load (reading from the 400 single pad instruments) a different PAD sound in each one of the 4 groups.
For example :
Main engine : empty 4 group instrument
In the instrument folder I have 10 single (1 group) PAD instruments (PAD 1, PAD 2 etc etc.)
When I hit the "random" button the main engine randomly load one single PAD instrument in each of the 4 groups.
So for example I will have : PAD 1 in Group1 - PAD 10 in Group2 - PAD 5 in Group3 - PAD 7 in Group4.
It's something possible?
Thanks in advance for any help!
- KVRAF
- 23102 posts since 7 Jan, 2009 from Croatia
You cannot do that. You need to have all those groups inside ONE instrument, and only then you can randomize between them.
-
- KVRist
- Topic Starter
- 46 posts since 23 May, 2006
thanks.
so if I have 400 single instruments, basically I have to create 400 Groups (one for each instrument) and then write a script that randomly load such instruments in Group1 - Group2 - Group3 - Group4?
so if I have 400 single instruments, basically I have to create 400 Groups (one for each instrument) and then write a script that randomly load such instruments in Group1 - Group2 - Group3 - Group4?
- KVRAF
- 23102 posts since 7 Jan, 2009 from Croatia
No. You don't load instruments in groups. You use purge_group() to select which groups will be loaded, which not.
-
- KVRist
- Topic Starter
- 46 posts since 23 May, 2006
thanks.
this looks a complicated task (a lot more than randomize the volume)
do you know if there is somewhere a similar script to take a look?
I tried to search in every forum but I didn't find it
this looks a complicated task (a lot more than randomize the volume)
do you know if there is somewhere a similar script to take a look?
I tried to search in every forum but I didn't find it
- KVRAF
- 23102 posts since 7 Jan, 2009 from Croatia
I don't think there is. You should just buckle down and figure it out bit by bit yourself perhaps
-
- KVRist
- Topic Starter
- 46 posts since 23 May, 2006
Ok I'm trying little step by step!
I have set up this script.
My idea is to tell kontakt to purge all groups when you load the instrument. (then I will try to write a script for randomly load 4 groups).
So basically when you open the instrument it will not load any group, then when you click on the "random" button you randomly load 4 groups (from the 8 available in this example). No idea how to add the "load random group"
This script works but I'm using a button to purge the groups... how can tell kontakt to purge all groups without the need to use a button?
Also there is a way to tell kontakt to purge the groups all at one without the need of list them all (purge_group(0,0) - purge_group(1,0) etc etc)? Thanks in advance for any help!
on init
declare ui_button $purge
set_text ($purge,"Purge All Group")
end on
on ui_control ($purge)
purge_group(0,0)
purge_group(1,0)
purge_group(2,0)
purge_group(3,0)
purge_group(4,0)
purge_group(5,0)
purge_group(6,0)
purge_group(7,0)
end on
I have set up this script.
My idea is to tell kontakt to purge all groups when you load the instrument. (then I will try to write a script for randomly load 4 groups).
So basically when you open the instrument it will not load any group, then when you click on the "random" button you randomly load 4 groups (from the 8 available in this example). No idea how to add the "load random group"
This script works but I'm using a button to purge the groups... how can tell kontakt to purge all groups without the need to use a button?
Also there is a way to tell kontakt to purge the groups all at one without the need of list them all (purge_group(0,0) - purge_group(1,0) etc etc)? Thanks in advance for any help!
on init
declare ui_button $purge
set_text ($purge,"Purge All Group")
end on
on ui_control ($purge)
purge_group(0,0)
purge_group(1,0)
purge_group(2,0)
purge_group(3,0)
purge_group(4,0)
purge_group(5,0)
purge_group(6,0)
purge_group(7,0)
end on
-
- KVRist
- Topic Starter
- 46 posts since 23 May, 2006
updated :
I only need to understand how to tell kontakt to randomly load 4 groups (from the 8 available) when i click the randomize button.
Thanks in advance for any help.
on init
declare ui_button $random
end on
on persistence_changed
purge_group(0,0)
purge_group(1,0)
purge_group(2,0)
purge_group(3,0)
purge_group(4,0)
purge_group(5,0)
purge_group(6,0)
purge_group(7,0)
end on
on ui_control ($random)
purge_group(0,1)
purge_group(1,1)
purge_group(2,1)
purge_group(3,1)
purge_group(4,1)
purge_group(5,1)
purge_group(6,1)
purge_group(7,1)
end on
I only need to understand how to tell kontakt to randomly load 4 groups (from the 8 available) when i click the randomize button.
Thanks in advance for any help.
on init
declare ui_button $random
end on
on persistence_changed
purge_group(0,0)
purge_group(1,0)
purge_group(2,0)
purge_group(3,0)
purge_group(4,0)
purge_group(5,0)
purge_group(6,0)
purge_group(7,0)
end on
on ui_control ($random)
purge_group(0,1)
purge_group(1,1)
purge_group(2,1)
purge_group(3,1)
purge_group(4,1)
purge_group(5,1)
purge_group(6,1)
purge_group(7,1)
end on
- KVRAF
- 23102 posts since 7 Jan, 2009 from Croatia
You can use purge_group() in while loops. Go through all groups like that, purging them, then unpurging those which are randomized.
-
- KVRist
- Topic Starter
- 46 posts since 23 May, 2006
thanks again for your help.
this work but kontakt randomise and play only one group.
how I can tell kontakt to choose 4 groups and play them all?
on init
declare $random_group_number := 0
declare ui_button $random
end on
on persistence_changed
purge_group(0,0)
purge_group(1,0)
purge_group(2,0)
purge_group(3,0)
purge_group(4,0)
purge_group(5,0)
purge_group(6,0)
purge_group(7,0)
end on
on ui_control($random)
if ($random =1)
$random_group_number := random(0,7)
purge_group(0,0)
purge_group(1,0)
purge_group(2,0)
purge_group(3,0)
purge_group(4,0)
purge_group(5,0)
purge_group(6,0)
purge_group(7,0)
purge_group($random_group_number,1)
end if
end on
on note
disallow_group($ALL_GROUPS)
allow_group($random_group_number)
end on
this work but kontakt randomise and play only one group.
how I can tell kontakt to choose 4 groups and play them all?
on init
declare $random_group_number := 0
declare ui_button $random
end on
on persistence_changed
purge_group(0,0)
purge_group(1,0)
purge_group(2,0)
purge_group(3,0)
purge_group(4,0)
purge_group(5,0)
purge_group(6,0)
purge_group(7,0)
end on
on ui_control($random)
if ($random =1)
$random_group_number := random(0,7)
purge_group(0,0)
purge_group(1,0)
purge_group(2,0)
purge_group(3,0)
purge_group(4,0)
purge_group(5,0)
purge_group(6,0)
purge_group(7,0)
purge_group($random_group_number,1)
end if
end on
on note
disallow_group($ALL_GROUPS)
allow_group($random_group_number)
end on