A script to fade-in an Audio gain when activating a rackspace

As this post is about a script, I have deleted it from the previous topic and moved it to this section.

I took inspiration from Automatic Fade Out written by @pianopaul to perform a guitar gain fade-in when a new rackspace is activated.

With a lot of difficulty because I don’t understand anything about scripts, I succeeded in creating an “ON/OFF” button to make or not the script running on rackspace activation.

I have also tried to create a “TIME” widget to select the duration of the fade-in, but I did not succeed in applying it to the SetGeneratorLength() function which seems to only accepts an integer…

Is is there a way to do this ?

Here is the script with some lines where I tried to insert timing elements but unfinished.
And the gig file
Auto Fade-In .gig (82.4 KB)

    AUTO : Widget // A button widget USED TO ENABLE THE RAMP
    TIME : Widget // A knob widget USED TO SET THE GENERATOR LENGHT
    GAIN : 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
    StartValue : double  // This remembers the initial value of the knob so that when we start again
                            // the knob will be reset to this value
    Timevalue : double  
    Running   : Boolean // Keep track of whether we are currently running the ramp

   SetGeneratorOneShot(myRamp, true) // Generator will only run once when triggered         
   myRamp.SetGeneratorLength(5000); // MILLISECONDS ONLY???

On Activate // A new rackspace is selected 
          StartValue := GetWidgetValue(GAIN) // Get the initial level of the knob (NB make sure it's not already 0
                                                // otherwise nothing will happen
          Timevalue := GetWidgetValue(TIME)                           
On WidgetValueChanged(newValue : double) from AUTO
    If newValue > 0.1 
        myRamp.EnableGenerator(True)         // Arm the ramp function generator
        SetTimersRunning(true)               // The ramp function generator will now start producing values
On TimePassing(timeX : integer, amplitudeY : double) from myRamp    // This gets called by the ramp generator as time passes
    SetWidgetValue(GAIN, StartValue + StartValue *70 *amplitudeY)    // start value = 0.1  *70 to reach end value = 70 

(formatted the code as “code” for better readability - schamass as Mod) :wink:

1 Like

Is this still necessary with the new GP4 audio tail options?


Also, do we need to have script functions to be able to set those audio tail options programatically?

1 Like

If I understand correctly from the title and description of this thread @Hermon is trying to fade IN the sound AFTER he activates a rackspace.

The options for audio tail and input muting are explicitly to control what happens when one switches away from that rackspace.

Whould it be possible via the System Actions plugin?

What about the current implementation does it follow a constant power fade in/ou transition like in the x-fader scriptlet? (if it is not the case it could be usefull)

Not sure how that makes sense — System Actions is for, well, system stuff, not specific rackspaces

Rackspace Name, Next/Previous Rackspace/Variations, these parameter are also related to rackspace/variations, so I thought perhaps that Rackspace Audio Tail stuffs could also be included…

Those are system commands to switch to the “next” item (rackspace, variation, etc) similar to what you can do through the Global MIDI options.

The discussion started from this post : Issue with rackspace change

As I encountered the same issue, I decided to find a solution to crossfade from one rackspace to another with 3 conditions:
playing continuously,
with a different sound in each rackspace,
with no level changes.
This is a morphing function.

This annotated image shows the scripted transitions in yellow and the non-scripted in green.

I don’t know GP well enough to say if there is a solution other than the script to achieve this regular level, but in the meantime, this one works fine except for the transition time which I can’t get to work.

Did you use the fade in and fade out audio tail for this example?

Yes, Input Muting and Output fading set both to 5 seconds, and the generator lenght in the script set to 2 seconds.

You can test this with my gig file uploaded above, using any continuous and regular audio input.
The script is deactivated in the 1st rackspace and activated in the 2nd one.

So you dis this for every rackspace and it doesn’t work for you?:thinking:

Sorry, I do not understand what you mean

I mean, you had the same audio tail settings (fade in/out at 5s) for each rackspace and the level still increased during transitions?

Yes when no script is applied, because previous input fading is added to sound played on next rackspace, so the signal is increased sharply at the beginning then decreases while input muting progresses .

With the script, as the sound played in new rackspace increased from 0 while previous input fading decreases, it works like a kind of constant level crossfade.

It is obvious to hear in the gig file: just insert a media file player in the 2 rackspaces with i.e. a 440Hz continuous signal playing and go from one rackspace to the other: you will hear a peak level on activating the rackspace with no script.

Time for me to go to bed, see you later :sleeping:

There’s no reason why the level would not increase for a short period in this scenario.

You’re playing one rackspace then you switch to a new one while playing. The new rackspace plays full volume immediately as it should and the old one has 5 seconds to quiet down. That’s how you set things up. If you used hardware units you’d hear exactly the same thing.

During that time both rackspaces “ring” with the old one quickly quieting down.

I’m trying to explain the process once more to make sure that we all understand that this is working as designed and, more importantly, as it should. There’s no magic bullet that would allow you to determine how quickly one wants the new rackspace to start playing and there is no algorithm that would do that for you. The only option is to play it immediately.

Consider the scenario where you play rackspace1, then stop playing and there’s no sound. Now you switch to rackspace2 - should the sound play full volume immediately or should it slowly come up for the duration of x number of seconds?

I’ve used this, on stage, for many years as have many other users, blasting the sound through some heavy PAs and this was never an issue. You could set the tail to 0 if you want to quiet the previous rackspace immediately.

1 Like

To get back to the problem I’m having with the script: is there any way to assign a variable to SetGeneratorLength()?
Or do I have to enter an integer? This would not be a problem as I only use this script occasionally and the value set in this function will not change for the rackspace concerned.

To tell the truth, until now, I never needed a x-fade transition between two Rackspaces and so never read the manual with this need in my mind. But I supposed that the « fade out » does a fade out transition from current volume to 0 during x seconds starting when switching to another rackspace. This seems to be the case. I also supposed that the « fade in » does a fade in of x seconds starting when entering the rackspace, such that if combined with another rackspace using a fade out, we could expect a smooth transition. So it seems I don’t understand what this « fade in » does and will have to check the manual. :grimacing:

@djogon has explained perfectly the transition mechanism that increases the volume during the release time of the input muting.

Before the arrival of GP4, I used to use a volume pedal to smooth out - when necessary - the attack of my guitar sound when changing rackspace.
Now, with the ability to use the input muting, the temptation is great to get a smooth morphing from one rackspace to another when necessary. I was used to using this crossfade function between presets on a Digitech multi-effects unit many years ago.

I recall that I have from a long time integrated this technique in my music within the same rackspace thanks to firstly Melda’s MRatio plugin then @Davidsan’s scriptlet x-fader and I can get now the same result between rackspaces thanks to the fade-in script.

I fully understand that this may not seem to you to be of essential use, but in the context of the music I play live, being the only instrumentalist accompanying a literary reader in total silence, the slightest difference in dynamics and sound level may be offensive. I try most of the time to stay in the same rack when it is necessary to do such a crossfade but sometimes I am forced to change rackspace when a lot of amps, fx and synths have to be replaced.

I don’t think it is necessary to continue this debate and to mobilize your time on this subject which remains very anecdotal compared to the expectations of the community. The essential point is that it works fine for me and I can even do without tweaking the rise time through a widget, just by typing it straight in the script. It concerns only a few rackspaces - though it is essential.

And I am really happy with GP, not only because of the functions it offers, but also thanks to the possibility to do things I would have thought impossible… such as this fade-in effect :slightly_smiling_face:

And many thanks again to all the devs and all those contributing to this wonderful adventure :star_struck: