How to: Switch between LAYERS using MIDI CC with KEY SWITCH REMOTE

Hello!

I am trying to figure out how to switch between Layers using a MIDI controller. I already made it work with Key Switches, but if I want to use lets say 50 different layers, I would lose 4 octaves of keyboard range only for keyswitches, so it seems not to be a viable solution.

However, a MIDI controller can have 127 positions, so it seems logical to use a MIDI controller to select one of the 50 layers. But I seem to be missing something, as I am unable to make appear the layers in the Key Switch Remote window.


Is this a malfunction? If so, has it been fixed in HALion 6.3 ( I am still on 6.2)?
Or is it my mistake?

Any idea how to solve this?

All the best.

Roger

Hi Roger,

You need to set up key switches first. Then they should appear in Key Switch Remote module.


However in your case it would probably defeat the purpose because you would have both the key switches and a midi cc doing the same thing. So you don’t save any keyboard range.

You could try using a script to select a layer to play. This can be mapped to a specific midi cc.

layers = this.parent:findLayers()
layerNames = {}

for i = 1, #layers do
  layerNames[i] = layers[i].name
end

defineParameter("LayerSelect", nil, 1, layerNames)
defineParameter("RemoteCC", nil, 1, 0, 127, 1)

function onNote(event)
  playNote(event.note, event.velocity, -1, layers[LayerSelect])
end

function onController(event)
  if event.controller == RemoteCC then
    this:setParameterNormalized("LayerSelect", event.value / 127)
  else
    postEvent(event)
  end
end

Just reload the script each time you make any changes (add or remove layers).

Hi Misohoza!

This forum really wouldn´t be the same without you.

I inserted the LUA script you posted ( I don´t have a clue how LUA works, so this was my first time LUAing…) and it worked right away. So thank a lot for your help.

The only thing I noticed is that the layer change is not realtime, but becomes effective with the next Note-on. While the layer change is correctly indicated inside the parameter list, it does sound until the next note-on. I guess this is for saving RAM and resources, because otherwise having for example 8 layeres, HALion would have to play those eight layers all the time, while sounding only one, let alone if I´d manage more layeres…

Or change the purpose from Switching to crossfading…
I´ll edit the your script and give a lecture to the HALion script information at steinberg.help.

Thank a million again for your help.

If you don’t need access to the layer names then here is another way of doing it in the attached preset.

You don’t need the key switch remote at all. Trick is to set Trigger note to Held Notes.
This is set up to change layers at 50% mod wheel position. You can obviously just set your own controller and use the range setting to set conditions for layers.
This will do real time switching.

Real time is possible with scripting too though.
Layer Select By Mod Wheel.zip (6.69 KB)

Hello Aposmus!

Thanks for uploading your example. I will check it out in the next days.
All the best.

Roger