Changing parameter increments

Post topics about HALion scripting.
Post Reply
User avatar
abject39
Member
Posts: 303
Joined: Sat Jan 17, 2015 8:20 pm
Location: Ventura, Ca
Contact:

Changing parameter increments

Post by abject39 » Tue Oct 10, 2017 4:02 am

Hey, I'm writing a bit of code that has me perplex on what I could be doing wrong. My goal is to Simple make the modmatrix depth move by whole numbers. I admit I'm a novice coder but I try anyway. I wrote this. It doesn't give me any sort of error but it also doesn't seem to move any parameter. A little help please.

Code: Select all

--Modulation whole number values
zone1=this.parent:getZone("Synth")

function onModAmountChange()
	AmountChange = wholenumber

   zone1:setParameter("Mod 1.Depth", AmountChange)

end
defineParameter("01ModAmount", "01ModAmount", 0, -100, 100, 1, onModAmountChange)
My vision is uncompromising: to transcend my clients dreams by mesmerizing their audience with the world's finest audio arrangements and products.

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

Re: Changing parameter increments

Post by misohoza » Tue Oct 10, 2017 11:36 am

Hi abject39.

There are couple of issues with your script.

Within your function you want to set parameter "Mod 1.Depth", such parameter doesn't exist unless you create it. The "AmountChange" is nil because you never assigned any value to it. To access the modulation matrix parameters you need to use getModulationMatrixRow()

Your parameter "01ModAmount", it's probably not a good idea to have a parameter name start with a number. I would do it other way around. ("ModAmount01")

Do you want to do this for a specific modulation row or for all of them? What if the destination is pitch. Do you still want to use the range of -100/+100 ?


You can try this. It should work for first modulation row.

Code: Select all

--Modulation whole number values
zone1=this.parent:getZone("Synth")

function onModAmountChange()
  zone1:getModulationMatrixRow(1):setParameter("Destination.Depth", ModAmount1)
end

defineParameter("ModAmount1", "ModAmount1", 0, -100, 100, 1, onModAmountChange)


Or if you want you can create several parameters at once using loop.

Code: Select all

--Modulation whole number values
zone1=this.parent:getZone("Synth")

for i=1,8 do
  defineParameter("ModAmount"..i, nil, 0,-100,100,1, function() onModAmountChange(i) end)
end

function onModAmountChange(i)
  zone1:getModulationMatrixRow(i):setParameter("Destination.Depth",_G["ModAmount"..i])
end
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
abject39
Member
Posts: 303
Joined: Sat Jan 17, 2015 8:20 pm
Location: Ventura, Ca
Contact:

Re: Changing parameter increments

Post by abject39 » Wed Oct 11, 2017 5:36 am

Thank you so very much! Clearly I have a lot to learn when it comes to coding. I try to write it but thus far modifying what already exist seems to what I'm best at. I can read it and mostly understand it but I guess I'm just not there yet.
My vision is uncompromising: to transcend my clients dreams by mesmerizing their audience with the world's finest audio arrangements and products.

User avatar
abject39
Member
Posts: 303
Joined: Sat Jan 17, 2015 8:20 pm
Location: Ventura, Ca
Contact:

Re: Changing parameter increments

Post by abject39 » Sun Oct 15, 2017 11:26 pm

misohoza wrote:
Tue Oct 10, 2017 11:36 am
Hi abject39.

There are couple of issues with your script.

Within your function you want to set parameter "Mod 1.Depth", such parameter doesn't exist unless you create it. The "AmountChange" is nil because you never assigned any value to it. To access the modulation matrix parameters you need to use getModulationMatrixRow()

Your parameter "01ModAmount", it's probably not a good idea to have a parameter name start with a number. I would do it other way around. ("ModAmount01")

Do you want to do this for a specific modulation row or for all of them? What if the destination is pitch. Do you still want to use the range of -100/+100 ?


You can try this. It should work for first modulation row.

Code: Select all

--Modulation whole number values
zone1=this.parent:getZone("Synth")

function onModAmountChange()
  zone1:getModulationMatrixRow(1):setParameter("Destination.Depth", ModAmount1)
end

defineParameter("ModAmount1", "ModAmount1", 0, -100, 100, 1, onModAmountChange)


Or if you want you can create several parameters at once using loop.

Code: Select all

--Modulation whole number values
zone1=this.parent:getZone("Synth")

for i=1,8 do
  defineParameter("ModAmount"..i, nil, 0,-100,100,1, function() onModAmountChange(i) end)
end

function onModAmountChange(i)
  zone1:getModulationMatrixRow(i):setParameter("Destination.Depth",_G["ModAmount"..i])
end
So, I took that code and changed it up to change the increments on the ADSR but I ran into a new issue. The defined parameter literally goes from 0 to 100. My goal was to convert the original -100 to 100 to 0-100 (instead it gave me half the range) so that the end user didn't see negative numbers. Do you know what function I can use to convert this?

Code: Select all

--ADSR for Amplitude Enevelope
print ("ADSR AMPlitude Envelope +++++++++++++++++++++++++++")

--Convert AMP Attack incrments
zone1=this.parent:getZone("Synth")

function onAmpAttackChange()
  zone1:setParameter(200, AmpAttack)
end

defineParameter("AmpAttack", "AmpAttack", 50, 0, 100, 1, onAmpAttackChange)

--Convert AMP Decay incrments
zone1=this.parent:getZone("Synth")

function onAmpDecayChange()
  zone1:setParameter(201, AmpDecay)
end

defineParameter("AmpDecay", "AmpDecay", 50, 0, 100, 1, onAmpDecayChange)

--Convert AMP Sustain incrments
zone1=this.parent:getZone("Synth")

function onAmpSustainChange()
  zone1:setParameter(202, AmpSustain)
end

defineParameter("AmpSustain", "AmpSustain", 50, 0, 100, 1, onAmpSustainChange)
My vision is uncompromising: to transcend my clients dreams by mesmerizing their audience with the world's finest audio arrangements and products.

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

Re: Changing parameter increments

Post by misohoza » Mon Oct 16, 2017 12:28 am

Multiply by 2 minus 100

Code: Select all

zone1=this.parent:getZone("Synth")

function onAmpAttackChange()
  zone1:setParameter(200, AmpAttack*2-100)
end

defineParameter("AmpAttack", "AmpAttack", 50, 0, 100, 1, onAmpAttackChange)

This should change the amp attack offset -100/+100% in 2% steps.
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
abject39
Member
Posts: 303
Joined: Sat Jan 17, 2015 8:20 pm
Location: Ventura, Ca
Contact:

Re: Changing parameter increments

Post by abject39 » Wed Oct 18, 2017 2:37 am

misohoza wrote:
Mon Oct 16, 2017 12:28 am
Multiply by 2 minus 100

Code: Select all

zone1=this.parent:getZone("Synth")

function onAmpAttackChange()
  zone1:setParameter(200, AmpAttack*2-100)
end

defineParameter("AmpAttack", "AmpAttack", 50, 0, 100, 1, onAmpAttackChange)

This should change the amp attack offset -100/+100% in 2% steps.
This worked completely but I have to ask one question... How? I just don't quite understand how this math worked. For example "-100*2-100= -300". How does this manage to work perfectly when defined? I just don't seem to grasp it. Sorry to bug but as a novice eager to learn as much as possible, I can't help but to ask.
My vision is uncompromising: to transcend my clients dreams by mesmerizing their audience with the world's finest audio arrangements and products.

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

Re: Changing parameter increments

Post by misohoza » Wed Oct 18, 2017 10:35 am

Your script parameter doesn't have negative values.

Minimum value: 0*2-100=-100
Default value: 50*2-100=0
Max value: 100*2-100=100
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
abject39
Member
Posts: 303
Joined: Sat Jan 17, 2015 8:20 pm
Location: Ventura, Ca
Contact:

Re: Changing parameter increments

Post by abject39 » Thu Oct 19, 2017 6:14 am

misohoza wrote:
Wed Oct 18, 2017 10:35 am
Your script parameter doesn't have negative values.

Minimum value: 0*2-100=-100
Default value: 50*2-100=0
Max value: 100*2-100=100
Well that makes sense lol. Thanks!
My vision is uncompromising: to transcend my clients dreams by mesmerizing their audience with the world's finest audio arrangements and products.

Post Reply

Return to “Halion Scripting”

Who is online

Users browsing this forum: No registered users and 1 guest