Switching between samples in a Zone

Use this forum to post about your macro page designs in HALion 6
Post Reply
User avatar
Steve1977
Junior Member
Posts: 76
Joined: Wed Jul 18, 2012 8:42 am
Contact:

Switching between samples in a Zone

Post by Steve1977 » Wed Dec 06, 2017 6:33 pm

Hi, I'm a beginner at this sound design stuff, so apologies if this is an obvious question.

I want to know, is there a way of flicking a switch on your instrument in the Macro builder and having it switch between samples in a zone?

I've got an instrument that plays 3 different guitar instrument samples at once (or individually if you solo / mute.)
Screenshot 2017-12-06 17.24.54.jpg
(127.85 KiB) Not downloaded yet
So Zone 1 is the electric gtr, Zone 2 the bass and Zone 3 the acoustic.

What I'd like to achieve is have different chord samples loaded up and waiting in the guitar zones (1 & 2) and with a flick of a switch change the guitars from Major chord samples to minor chord samples. (If that's possible, I'd also like to then go on to add 7th's, 6ths, 5ths etc etc)

Is this even possible? I can't find a way of switching between samples in a zone. I'm a complete novice at this stuff, so if the answer is code, I'm probably in even bigger trouble. :lol:
Cubase Pro 10 / Wavelab Pro 9.5 / Halion 6 / HSO / The Grand 3 / Tribework / BFD 3 / Kemper Rack / Windows 10 64bit / Saffire Pro 40 / UAD2 Satellite & Pci / Waves 10

PC / Windows 10

misohoza
Member
Posts: 834
Joined: Sun Oct 05, 2014 12:18 am
Contact:

Re: Switching between samples in a Zone

Post by misohoza » Thu Dec 07, 2017 12:14 am

Hi Steve,

What you are trying to achieve is possible.

I would suggest to create layers for each of your chords. One for major chords samples, one for minor chords samples...
If you're happy with using keyswitches to change which chords are being played then all you need to do is add and set up a MegaTrig module.

If you want to use a macro page knob or menu then some scripting might be necessary.
Have a look at the attached preset. I've used synth zones but you can apply the same logic to sample zones.
Layer Selector.zip
(5.88 KiB) Downloaded 78 times
Win 10 Home, 64 bit, 8 gb ram,
Cubase Pro 9, Wavelab Pro 9, Halion 6, Dorico,
NI Komplete 10 Ultimate, Ozone 7,
UR 44

User avatar
Steve1977
Junior Member
Posts: 76
Joined: Wed Jul 18, 2012 8:42 am
Contact:

Re: Switching between samples in a Zone

Post by Steve1977 » Thu Dec 07, 2017 1:32 am

misohoza wrote:
Thu Dec 07, 2017 12:14 am
Hi Steve,

What you are trying to achieve is possible.

I would suggest to create layers for each of your chords. One for major chords samples, one for minor chords samples...
If you're happy with using keyswitches to change which chords are being played then all you need to do is add and set up a MegaTrig module.

If you want to use a macro page knob or menu then some scripting might be necessary.
Have a look at the attached preset. I've used synth zones but you can apply the same logic to sample zones.
Layer Selector.zip
Hi Misohoza,

Wow! Thank you so much.

Your preset and the attached code worked perfectly. I just adapted it for my audio samples and zone names and I can now switch from major to minor to sus 4 etc samples. Genius!

Im so grateful. Thanks again mate.

Im going to bed relieved. Cheers.
Cubase Pro 10 / Wavelab Pro 9.5 / Halion 6 / HSO / The Grand 3 / Tribework / BFD 3 / Kemper Rack / Windows 10 64bit / Saffire Pro 40 / UAD2 Satellite & Pci / Waves 10

PC / Windows 10

misohoza
Member
Posts: 834
Joined: Sun Oct 05, 2014 12:18 am
Contact:

Re: Switching between samples in a Zone

Post by misohoza » Sat Dec 09, 2017 5:21 pm

I'm glad it worked.

There are several ways how to deal with situation like this.

When you wrote you want to automate the layer switching it made me think whether this is the right approach. The preset attached in my previous post works by changing the "LayerMidiMute" parameter. When you turn the knob it mutes everything and unmutes the selected layer. So if you play a note and turn the macro page knob while the note is still held the note will be cut off.

So I tried to change the script slightly to make it work on per note basis and avoid cutting off notes when turning the knob:

Code: Select all

layers = this.parent:findLayers()

function getLayerNames()
  layerNames = {}
  for i, layer in ipairs(layers) do
    layerNames[i] = layer.name
  end
end

getLayerNames()

defineParameter("LayerSelect", nil, 1, layerNames)


function onNote(event)
  playNote(event.note, event.velocity, -1, layers[LayerSelect])
end
Layer Selector 2.zip
(5.59 KiB) Downloaded 61 times


If you find you prefer this behaviour try it on a dummy program first.

When I tried to fix the original preset by changing and reloading the script it looked like it doesn't work. This happened to me several times before and usually it's enough to reload the program and/or restart Halion to fix this. But this time it doesn't.


Here's the same script saved as a midi module preset with a simple macro page:
Layer Selector Midi Module.zip
(1.76 KiB) Downloaded 63 times
Image
Win 10 Home, 64 bit, 8 gb ram,
Cubase Pro 9, Wavelab Pro 9, Halion 6, Dorico,
NI Komplete 10 Ultimate, Ozone 7,
UR 44

User avatar
Steve1977
Junior Member
Posts: 76
Joined: Wed Jul 18, 2012 8:42 am
Contact:

Re: Switching between samples in a Zone

Post by Steve1977 » Sun Dec 10, 2017 2:19 pm

misohoza wrote:
Sat Dec 09, 2017 5:21 pm
I'm glad it worked.

There are several ways how to deal with situation like this.

When you wrote you want to automate the layer switching it made me think whether this is the right approach. The preset attached in my previous post works by changing the "LayerMidiMute" parameter. When you turn the knob it mutes everything and unmutes the selected layer. So if you play a note and turn the macro page knob while the note is still held the note will be cut off.

So I tried to change the script slightly to make it work on per note basis and avoid cutting off notes when turning the knob:

Code: Select all

layers = this.parent:findLayers()

function getLayerNames()
  layerNames = {}
  for i, layer in ipairs(layers) do
    layerNames[i] = layer.name
  end
end

getLayerNames()

defineParameter("LayerSelect", nil, 1, layerNames)


function onNote(event)
  playNote(event.note, event.velocity, -1, layers[LayerSelect])
end
working code.jpg
(136.28 KiB) Not downloaded yet


If you find you prefer this behaviour try it on a dummy program first.

When I tried to fix the original preset by changing and reloading the script it looked like it doesn't work. This happened to me several times before and usually it's enough to reload the program and/or restart Halion to fix this. But this time it doesn't.


Here's the same script saved as a midi module preset with a simple macro page:
not working.jpg
(115.22 KiB) Not downloaded yet
Image
Hi Misohoza,

Thanks again for all your help, can't tell you how much I appreciate it.

It's almost certainly something I'm doing wrong, but I can't get your new code to work with my program. I've attached a pic of my layer tree, so you can see what I'm up to.
tree.jpg
(274.14 KiB) Not downloaded yet
Below I've attached a pic of your first code that DOES work with my instrument (ie: it plays sounds and changes the chords when the knob is turned), but you're absolutely right that I'm getting some issues with sounds not playing when changing chords in automation in cubase, probably because of the mute feature you mentioned.
working code.jpg
(136.28 KiB) Not downloaded yet
And finally, below I've attached a pic of your latest code in my program. I can't seem get any sounds out of it with my program (I can see it works great on your 'Layer Selector 2), even when making a dummy program. Again, I'm probably doing something stupid and need to rename something ?
not working.jpg
(115.22 KiB) Not downloaded yet
For my final embarrassment, I couldn't get your Midi Module to load up either? I can't seem to find in HAlion where you're meant to load Midi modules and not scripts? Apologies again for my ignorance.

If you could offer any more advice or help I'd be eternally grateful. :)
Cubase Pro 10 / Wavelab Pro 9.5 / Halion 6 / HSO / The Grand 3 / Tribework / BFD 3 / Kemper Rack / Windows 10 64bit / Saffire Pro 40 / UAD2 Satellite & Pci / Waves 10

PC / Windows 10

misohoza
Member
Posts: 834
Joined: Sun Oct 05, 2014 12:18 am
Contact:

Re: Switching between samples in a Zone

Post by misohoza » Sun Dec 10, 2017 5:24 pm

And finally, below I've attached a pic of your latest code in my program. I can't seem get any sounds out of it with my program (I can see it works great on your 'Layer Selector 2), even when making a dummy program. Again, I'm probably doing something stupid and need to rename something ?
:) This one had me puzzled for a while too. What happens is that when you change the script it loads the new script but doesn't automatically undo whatever the old script did. The old script changed the "LayerMidiMute" parameter of all layers except for the selected one to "On" which effectively mutes them.

To fix this open parameter list, check each layer has the "LayerMidiMute" parameter set to "Off".

You could use a script to do this for you. Add Lua Script module, paste the following and press ok.

Code: Select all

layers = this.parent:findLayers()

for i, layer in ipairs(layers) do
  layer:setParameter("LayerMidiMute", false)
end
Once the script has done its job you can safely delete this Lua script module from the program tree.

I couldn't get your Midi Module to load up either? I can't seem to find in HAlion where you're meant to load Midi modules and not scripts?
You can save a midi module preset the same way as you can save presets for effects, envelopes...
This is a midi module preset. This file needs to be placed in:

Code: Select all

C:\Users\Username\Documents\Steinberg\HALion\Sub Presets\MIDI Modules
This path is created by Halion when you save a preset but you can create the required folders manually if they don't exist.

Then when you click "Create New Midi Module" all presets in that folder should appear in the list.
Win 10 Home, 64 bit, 8 gb ram,
Cubase Pro 9, Wavelab Pro 9, Halion 6, Dorico,
NI Komplete 10 Ultimate, Ozone 7,
UR 44

User avatar
Steve1977
Junior Member
Posts: 76
Joined: Wed Jul 18, 2012 8:42 am
Contact:

Re: Switching between samples in a Zone

Post by Steve1977 » Sun Dec 10, 2017 5:52 pm

misohoza wrote:

:) This one had me puzzled for a while too. What happens is that when you change the script it loads the new script but doesn't automatically undo whatever the old script did. The old script changed the "LayerMidiMute" parameter of all layers except for the selected one to "On" which effectively mutes them.

To fix this open parameter list, check each layer has the "LayerMidiMute" parameter set to "Off".

Thanks again for all your help!

I'm sorry to say, that didn't seem to do it.

The muteMIDILayers were already all set to 'off', I ran the code anyway just to be sure, but I'm still getting no sound from my samples with the 2nd code.

As an experiment I added your Sine / Triangle / Saw etc sounds to my layer 1 (Along side my guitar chord samples. Your synth sounds played perfectly, but when I switch the knob to my chords i just get silence. (I get sound finewith the first code, but I get the midi mute problem with automation)

So it's playing the synths, but not the samples . I'm very puzzled!
Cubase Pro 10 / Wavelab Pro 9.5 / Halion 6 / HSO / The Grand 3 / Tribework / BFD 3 / Kemper Rack / Windows 10 64bit / Saffire Pro 40 / UAD2 Satellite & Pci / Waves 10

PC / Windows 10

User avatar
Steve1977
Junior Member
Posts: 76
Joined: Wed Jul 18, 2012 8:42 am
Contact:

Re: Switching between samples in a Zone

Post by Steve1977 » Sun Dec 10, 2017 8:48 pm

Update!

I've no idea what I've done differently, but I've just got it working. Your 2nd code!

Maybe halion was messing up before, but I've just tested it in cubase and it works great.

No idea what happened, but I'm very pleased. Thank you again for all your help ☺️👍
Cubase Pro 10 / Wavelab Pro 9.5 / Halion 6 / HSO / The Grand 3 / Tribework / BFD 3 / Kemper Rack / Windows 10 64bit / Saffire Pro 40 / UAD2 Satellite & Pci / Waves 10

PC / Windows 10

misohoza
Member
Posts: 834
Joined: Sun Oct 05, 2014 12:18 am
Contact:

Re: Switching between samples in a Zone

Post by misohoza » Sun Dec 10, 2017 9:11 pm

Good to hear it's working.

I was going to post a variation of the 2nd code that should fix the LayerMidiMute problem of the first script. In case there were still some layers left with the LayerMidiMute turned on by mistake.

Code: Select all

layers = this.parent:findLayers()

function getLayerNames()
  layerNames = {}
  for i, layer in ipairs(layers) do
    layer:setParameter("LayerMidiMute", false) --fix the LayerMidiMute from previous script
    layerNames[i] = layer.name
  end
end

getLayerNames()

defineParameter("LayerSelect", nil, 1, layerNames)


function onNote(event)
  playNote(event.note, event.velocity, -1, layers[LayerSelect])
end
But if it's working then don't bother.

Good luck with your instrument.
Win 10 Home, 64 bit, 8 gb ram,
Cubase Pro 9, Wavelab Pro 9, Halion 6, Dorico,
NI Komplete 10 Ultimate, Ozone 7,
UR 44

Post Reply

Return to “Macro Page Design”

Who is online

Users browsing this forum: No registered users and 1 guest