At the moment, my instruments just drop out using a widget volume fader and CC#7. Is there a way to fade a fader in or out rather than a using a series of incremental steps?
You could use the generators within the GPScript to automate any widget.
On a side note ā¦ is there a reason why youāre using CC#7 to change the volume of your instruments rather than using a gain control or a mixer?
I am using a mixer with the volume slider droping up and down via cc#7. Id like it to fade up and down gradually. Is there a pre-written script for this?
There are no pre-written scripts. Youād have to experiment a bit and read the GPScript documentation unless someone already has that kind of script and they are wiling to share it here.
Hi, maybe this script helps you:
Var
MASTER : Widget // A knob triggered by the ramp
var
myRamp : Ramp // A generator that moves smoothly from 0.0 to 1.0 over some specified time
MTW : MidiInBlock
v_value : double
v_run : integer
initialization
SetGeneratorOneShot(myRamp, true) // Generator will only run once when triggered
myRamp.SetGeneratorLength(2000); // Two seconds
v_run = 0
// Also, check the SetGeneratorCoarseness function
// which can be used to control how often we get called back
// Choose values wisely! You're trading accuracy against CPU cycles
end
// Use this to trigger the ramp
On NoteOnEvent(m : NoteMessage) matching C1 from MTW
If v_run == 0 then
v_value := GetWidgetValue(MASTER)
v_run = 1
myRamp.EnableGenerator(True)
SetTimersRunning(true)
else
SetWidgetValue(MASTER, v_value)
v_run = 0
end
End
// This gets called by the ramp generator as time passes
on TimePassing(timeX : integer, amplitudeY : double) from myRamp
if v_run == 1 then
SetWidgetValue(MASTER, v_value - v_value*amplitudeY)
end
end
Hi pianopaul. Thatās fantastic! But how do I use it? Can I adjust the time for ramp up and down? Do I copy all of the text in, or is some of what youāve written instructional? Sorry for the questions but Iām very ignorant about how to use scripts.
Free tip @bigalminal (if you would like to notify someone just put @ before its alias/name)
Easy! (has @pianopaul already did all the āmagic-recepieā)
-
YES copy all the text inside the square
-
Open the Script Editor
-
paste to (Live) green tab (this will become the script
-
DONT press Compile just right now, you are missing some āthingsā
-
Go to Layout Designer - Drop a Button and Name it (as the Script indicates) MASTER, press enter
-
You have to have a MIdiInBlock ārecognisedā to the script: like follow:
-
And now go press Compile!!
Sure!! look at:
myRamp.SetGeneratorLength(2000); // Two seconds
Hope this helpsā¦
It takes some time, readings to grasp all whats going on in a script.
this helps:
https://community.gigperformer.com/t/updated-language-docs/768?u=keyman
Well Iāve had a go and followed the instructions. But I got this message -
āThe widget MASTER is declared in a script but does not exist in the rackspace called (name of the song)ā. Did I miss a step out for this message to appear?
No worries, its your first timeā¦
Please double check this:
- Go to Layout Designer - Drop a Button and Name it (as the Script indicates) MASTER, press enter
- and then, Compile
I have made it work, but this is misleadingā¦
Instead of a button I used a knob (this is what the script is āautomatingā) mapped to a Gain and Balance Block
Does it Compile?
When you press a C1 key going into the MidiInBlock you see the values go up-down
(reported by the Script Logger window)
Still not working, but I have some questions.
1 Button or knob - does it matter?
2 Can I use a mixer fader instead of a gain control?
3 Does the MTW title stand for anything in particular?
4 No midi channels are mentioned? Does this matter?
5 I presume a second triggering of C1 will cause the
Fade out?
6 No midi learn was mentioned in the properties
window where MASTER was typed in. Is this
necessary?
Sorry if these questions sound silly, but I am determined to get this working.
Finally, what is the best way to print these instructions out? Could a PDF be made so I could save it all for future reference!
Finally number two - thanks so much guys for your help and patience - I love this forumā:yum:
Knob ā the script is reducing the value of the knob continuously from its starting point to 0. A button does not have continuous change, itās only on or off. But I understand the confusion - the comment in the script is wrong. See the bottom of this message. With apologies to @pianoman (who I however thank for providing the initial script) I have modified it slightly and updated all the comments to explain more clearly whatās going on.
You can use anything you want ā just associate that knob widget with some parameter of whatever plugin you want to use.
The script is not checking for a MIDI channel for the the note message (note C1 coming into a MidiInBlock) so it doesnāt matter what MIDI channel is being used on the keyboard.
Thereās nothing to learn
Donāt be sorry ā if you havenāt done any programming before, this stuff can seem rather overwhelming at first. More power to you for being willing to get up to speed with this stuff
Var
MASTER : Widget // A knob widget used to trigger the ramp
myRamp : Ramp // A generator that moves smoothly from 0.0 to 1.0 over some specified time
MTW : MidiInBlock // The MidiIn Block from where the trigger note will come
StartValue : double // This remembers the initial value of the knob so that when we start again
// the knob will be reset to this value
Running : Boolean // Keep track of whether we are currently running the ramp
initialization
SetGeneratorOneShot(myRamp, true) // Generator will only run once when triggered
myRamp.SetGeneratorLength(2000); // Two seconds
Running = false // When we start up, the ramp is not running
end
// This callback will be triggered only when the note C1 is received
On NoteOnEvent(m : NoteMessage) matching C1 from MTW
Print("Run state: " + Running) // Print true or false each time we're called depending
// on whether we are currently responding to the ramp
If not Running
then
StartValue := GetWidgetValue(MASTER) // Get the initial level of the knob (NB make sure it's not already 0
// otherwise nothing will happen
Running = true // Remember that we are now running the ramp
myRamp.EnableGenerator(True) // Arm the ramp function generator
SetTimersRunning(true) // The ramp function generator will now start producing values
else
SetWidgetValue(MASTER, StartValue) // If we were running then reset the knob to the initial value again
Running = false // and remember that we are now NOT running
End
End
// This gets called by the ramp generator as time passes
On TimePassing(timeX : integer, amplitudeY : double) from myRamp
Print(amplitudeY) // Just lets you see the value of the ramp as time passes
if Running
then
// The amplitude of the ramp goes from 0.0 to 1.0 so if we multiply that amplitude
// by the INITIAL start value of the knob, we generate a value that gets closer to the
// actual StartValue over time
// Therefore, subtracting that from the initial StartValue causes the
// the actual value to reduce down to zero
// Hence the knob slowly reduces to 0
SetWidgetValue(MASTER, StartValue - StartValue * amplitudeY)
end
end
Hereās an image of the script so you can see it with colors, might be easier to read
One step forward and two steps back! Sorry, but the modified script gave me the following message:
Syntax Error: Line 48, Col 13: Unexpected or unrecognized token: āā
Missing End at āā
How do I fix this please?
Always forward
Copy again, All text!!
You can import a file with the script
Just download from this link, unzip and then:
Open script from file
Sounds like you didnāt copy the complete script exactly as posted
Ok, I got the Dropbox script file and it compiled ok. Now my error message is saying I havenāt got a plugin called MTW. What is MTW? Can I call it something else? Sorry, but I still need helpš
Please review the earlier responses from @keyman. He explained specifically what was MTW complete with graphic images to show you how to configure it.
Itās great that you are trying to use GPScript, but I would advise that you get familiar with the basic GP functionality first.
You would save a lot of time if you go through our quick start guides, videos and in particular the full manual.
Once you figure out how things work - GPScript will make much more sense and everything that people are referring to in their helpful answers will make much more sense.
MTW is a NAME of your MIDI Input block which you can set by right clicking on the midi in block, selecting to set the name and then enabling the GPScript for it.
Again - if you go through basics of GP rather than jumping to really, really advanced functionality - this would be all self explanatory to you.
Hope this helps.