# Sample Selection Via Mod Wheel Position?



## Firstblock (Aug 13, 2013)

I'm wanting to have three different samples on the same MIDI key and then use the mod wheel as a modifier to dictate which sample is triggered. I need it to work as a modifier rather than a switch or modulation, so before you press a key you can hold the mod wheel to one side and then the according sample will be played dependent on the current position of the mod wheel. 

I'm struggling to figure out how to achieve this, and would really appreciate some scripting help. Any ideas? Thanks heaps!


----------



## d.healey (Aug 13, 2013)

There are a number of ways to do this.

You could create three groups and give them each a CC1 controlled volume modulator and using the modulation shaper make it so each group is only audible when the modwheel is in one position. Then you would put your three samples on the same key in the three groups.

Another way would be to create three groups, one sample in each and use scripting so that when the modwheel is moved within a certain range one group is enabled and the others disabled, then when you play a note only one will sound.

There are many variations on this second method including all notes in one group separated via velocity and using the modwheel to limit the velocity of incoming notes, or you could space them on the keyboard and trigger them using play_note() and the note selection could be controlled by the modwheel. 

If you want more details of one of these methods just let me know


----------



## Rob (Aug 13, 2013)

maybe the simplest way would be to create three groups, each assigned to the same key(s), and then in "group start options" - group starts - on ctrl - cc1 - is between 0 and x - is between x+1 and y - is between y+1 and 127 respectively


----------



## mk282 (Aug 13, 2013)

Rob, that would behave like a switch (it would only change the group on newly played note), which is not what Firstblock wants.


----------



## Rob (Aug 13, 2013)

mk282 @ 13th August 2013 said:


> Rob, that would behave like a switch (it would only change the group on newly played note), which is not what Firstblock wants.



Sorry, I misunderstood...


----------



## Firstblock (Aug 14, 2013)

I used the enable/disable groups method since my velocity was already in use to select different samples. It all seems to be working well together now. Thanks heaps for the replies!  

I have another question though, is it possible to get the file name of the file that is currently or most recently triggered to display in the custom GUI? Or even better, just part of the file name? Is string manipulation simple enough in KSP?


----------



## Nick Batzdorf (Aug 14, 2013)

This is cut and paste from my world-famous book on sampling. It might be helpful, or it might be too late.



Adding the two long note articulations is more of the same procedure, only the Group Start parameters will be different. What we're going to do is have the non-vibrato notes trigger only when the mod wheel is on less than half way (1 - 64) and the notes with vibrato sound when it's over half way (65 -127); when the mod wheel is of (0) then the round-robin staccato and short notes will trigger as before.

- Create new groups called "long no vib" and "long vib."

[fig: New groups long no vib, vib]

- Drag in the two sets of samples:

[fig: long notes in]

- Now we have to set the long no vibs to start when the mod wheel (MIDI CC#1) is between 1 and 64 and the long vibs start when it's between 65 and 127. This is just a different Group Start parameter:

[fig: long no vib cc1 1-64]

[fig: long vib cc1 65-127]

Try playing the alto recorder program with the mod wheel all the way off. You'll hear the short notes behaving just as before, with the stacc notes at low velocities and the short notes at high ones.

Now move the mod wheel up somewhere below halfway. The long no vib sounds. Move the mod wheel over halfway and the long vib sounds.

Except that the short notes are also sounding the same time. We need an additional Group Start setting.

- Set up a second Group Starts condition: Group Starts on ctrl. CC# 1 is between 0 and 0. This has to be done for each of the four groups—stacc 1, stacc 2, short 1, short 2:

[fig: other groups cc1 0 only]

[fig: more other groups cc1 0 only]

And now the program works correctly.


----------

