MIDI keyboard range script?
-
@meyerkeys Hi
You can set the slider ranges in the property editor of your sliders (0-127) (don't forget to set thestepSize
to 1)Then first solution:
- Create the slider's Script Reference in the onInit callback.
- Then in the
noteOn
callback, you can replace thelower_range
variable withmyLowRangeSlider.getValue()
Second solution:
- Keep the
const var lower_range
variable - Create a callback for your slider in the
onInit
- In the callback, place
lower_range = value;
-
@ustk said in MIDI keyboard range script?:
@meyerkeys Hi
You can set the slider ranges in the property editor of your sliders (0-127) (don't forget to set thestepSize
to 1)Then first solution:
- Create the slider's Script Reference in the onInit callback.
- Then in the
noteOn
callback, you can replace thelower_range
variable withmyLowRangeSlider.getValue()
Second solution:
- Keep the
const var lower_range
variable - Create a callback for your slider in the
onInit
- In the callback, place
lower_range = value;
'cept it couldnt be
const var lower_range
it would need to be
var lower_range
-
@Lindon Oups sorry, you're right
const
shouldn't be here... -
Many thanks guys!
I wondered about "const" as well but I got it working with both versions.
Cheers!
-
@meyerkeys yes the first solution @ustk offered may well work but the second wont as:
lower_range = value;
means you are assigning a value to a constant - and that wont work. constants get set and can never be changed - theyre, huh, constant...:-)
-
If the constant is an object you can change the object's contents.
const var foo = [1, 2, 3]; foo[1] = 10; Console.print(foo[1]);
-
Thank you guys for staying on this.
I kind of wondered about the const or const var thing anyway as David is using const var mostly in his great videos. Can't thank you enough for those btw.
So your last post clarifies again. Got it. -
@meyerkeys You can find more information in the doc about the different variables in Hise
https://docs.hise.audio/scripting/scripting-in-hise/additions-in-hise.html#const-variables -
Guys sorry for reviving this old topic,
I have two Sampler, and one Synth Group, and with the script above i can set the note range for all of them. No problem here - but how can i control my samplers seperately. So that i can set a range for Sampler1, 2 and my Synth Group?
Thanks so much
best
Ben -
@Ben-Catman put the script in three separate script processors one in each sound source.
-
so you mean i move everything, including the oninit part to the script processor? because in the script processor it cant get my slider value. so how can i cross reference that?
-
@Ben-Catman create a slider in your script processor and change that from your UI
start like this in the script processor on init
const var LowRange = Content.addKnob("LowRange", 10, 0); LowRange.setRange(0, 126, 1); const var HighRange= Content.addKnob("HighRange",180, 0); HighRange.setRange(1, 127, 1);
-