Create a volume ramp up and fade out

T. - please consider creating a post in the User scripts section of the forum with this script/explanation. This may help others as well looking for such a script. Thanks

A little experimenting won’t break anything :wink: also go back on the post with step by step.
If you changed MTW in the MIDIInBlock and in the script for MyMorningCoffe it would also work.

Post from the creator of the above script

2 Likes

Thanks for the good advice. Regarding MTW - I knew it was the midi in block but thought the letters may have had some significance. I understand what folk are saying - read up on scripting and gain an understanding. I will do this I’m sure. But at the moment, I’m on a journey that started in April about Easter time. It was then I decided to make the switch from Forte to Gig performer. I have over 300 racks to transform to the new platform and I’m now in the S’s alphabetically. I’ve had crashes and other glitches that have eaten and wiped out many of my files that I’ve had to reconstruct. I perform as a solo act using a PS3 wireless guitar controller driving Music Labs Real Guitar (all 11 of them) and various other vst’s including Strike 2 as a rhythm device. Yesterday after trying and failing to get the volume ramp script going, plus other minor interuptions, I managed to complete 5 new racks for the whole day! So I’m keen to press on and complete the mission. Then I’ll come back and begin refining what I already have by reading and understanding what I need to know. Thanks to everyone for their help and patience.

1 Like

Well, I backed off, slowed down and tried again and had some success.
I now have the compiler window showing values which is great. I have a volume knob mapped to a mixer fader but am having some trouble getting the automation going. Nothing happened for the first couple of C1 presses, and then suddenly there was action. But the knob/mixer fader went down far too quickly in about 1/2 second. So I altered the script from 2 seconds to 4 seconds, and then the fader stopped working. I’ve experimented with other time values but the automation won’t work again. Also, when it does fade out, I’m not sure how to actuate a fade back in. A second C1 press made the fader rise a 1/2” then it dropped back to nothing again. Ah well, I’d appreciate any more thoughts on trouble shooting.

I’ve had a break through here. Rather than persevere with scripting, I searched and finally found a plugin called MRthymizer from Melda Productions. Adjustable ramps over time and triggered by midi notes. Took a while to figure out but meeting all my needs.

2 Likes

Melda stuff is wonderful. Also for this kind of thing, Cableguys have some great plugins.

I revised the script a bit to make it go slowly up and down (the original one above goes down only afaik?)
I just revised it so credits go to @pianopaul .

Var
   fadeInOutButton : Widget // A knob triggered by the ramp
   volumeKnob : widget

var
   myRamp  : Ramp // A generator that moves smoothly from 0.0 to 1.0 over some specified time
   StartValue : double
   Running : Boolean
   DirectionDown : Boolean
   
initialization
   SetGeneratorOneShot(myRamp, true) // Generator will only run once when triggered         
   myRamp.SetGeneratorLength(1000); // in ms
   Running = false
   DirectionDown = true
   SetWidgetValue(volumeKnob, 1.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   


// Called when a single widget value has changed
On WidgetValueChanged(newValue : double) from fadeInOutButton
   DirectionDown = !DirectionDown
   Print("Run state : " + Running)
   StartValue = GetWidgetValue(volumeKnob)
   Running = true
   myRamp.EnableGenerator(True)
   SetTimersRunning(true)
End


    // This gets called by the ramp generator as time passes
On TimePassing(timeX : integer, amplitudeY : double) from myRamp
   var value : double
   Print(amplitudeY) // Just lets you see the value of the ramp as time passes
   Print("Run tate : " + Running)
   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
      Print("StartValue = " + StartValue)
      if DirectionDown then
         value = amplitudeY
      else
         value = StartValue - StartValue * amplitudeY
      end
      Print("Val = " + value)
      SetWidgetValue(volumeKnob, value)   
   end  
end
2 Likes