How to delay a control change message

Hi,
I would like to delay a specific control change message for 40 milliseconds.
More specific I use a midi pedal as a ‘midi block in’ that sends a cc 64 Hold pedal 127 that I would like to get delayed for milliseconds after I put my foot on it.
Releasing my foot cc 64 Hold pedal 0 should be instant, so without delay.
Can this be achieved with gp script or it there a simpler way to achieve this within GP?
Maybe some advice on how to apply the script. I am new to this.
thanks.

This can be done in GP script.
Tomorrow I can create an example.

thanks, I look forward to it.

As I am curious, I am always interested in the particular use cases. Why exactly do you need to delay this message?

In your script you can replace SendNow by SendLater:

SendLater ( p , m , delayInMS )

Schedule a MIDI event to be sent out at some specified time in the future

Parameters

1 Like

Thanks for your reaction, David-san.
​Hi,

I am using Gig performer for a midi guitar that provides a midi bass on the lower strings.
I do mostly accompanying work on the acoustic guitar and adding a bass sound, really adds to the live performance.

So I use Fishman Tripleplay hardware and software​ and a Fishman’s midi foot pedal FC-1
In the Fishman tripleplay software there is function called hold that does two things:
It holds the last midi note (so the bass, in my case spectrasonics Trilian),
while it blocks all other incoming midi notes until the foot releases from the midi foot pedal.

This is very useful, because it avoids that the bass midi notes are sounding when it’s not needed.
The tricky thing is you would have to press and hold the midi pedal right after the midi bass note is played which is kind of against the natural feel

It is much easier to press the pedal on the beat and that is why I need this delay for the midi cc 64 127 message. If there is no delay and you press the midi pedal on the beat you might cut off the bass that was on the beat.

I hope that all makes sense to you.

Thanks for your explanations on the script, but do you have somewhere a gig performer explanation for how to implement these scripts practically.

The fishman triple play foot pedal fc-1 is a midi in block which is connected to the spectrasonics Trilian vst out (the Trilian is a vst sampler that provides the bass sounds)
I suppose the script should be inserted somehow in between, right?

Best regards,
Hein

OK, I understand.

right clic on the appropriate MIDI in block and set a script handle named “MIDIin”

Then, go to “Window” menu, then to “Show script editor” copy this and compile:

//$<AutoDeclare>
// DO NOT EDIT THIS SECTION MANUALLY
Var
   MIDIin : MidiInBlock
//$</AutoDeclare>

//Called when a CC message is received at some MidiIn block
//The CC numbers must be within the specified range

On ControlChangeEvent(m : ControlChangeMessage) Matching 64 from MIDIin
Var
  CCValue : int;
  
  CCValue = m.GetCCValue();
  
  if (CCValue == 127)
  Then
    MIDIin.SendLater(m, 40.0); //40.0 is the delay in ms
  Else
    MIDIin.SendNow(m);
  End
End

I didn’t test it but I suppose it should do the job. Let me know if it works or not…

1 Like

Hi David-san,
thanks for your swift and extensive personal help to a newbee like me.
It is really appreciated.
I will let you know how it works, it might take me a day or two. Happy New Year.

I don’t believe it :stuck_out_tongue_winking_eye:

If it doesn’t work, you will have to play the sustain pedal like a pianist : foot up on the beat and down again afterwards. :wink:

I meant a day or two because of the new year festivities. I mean before I can start on it. H.

Hello David-san,
you send me quite a while ago a GPscript to delay a CC message. I did not get to work at the time but since then, I got to know better Gigperformer and gave it another try. It works fine now. Just one small detail. when I use the script it sends the cc message out on midi channels 1 to 6. I only need it on channel one. How do I limit this to channel one only?
Here is the script:

//$
// DO NOT EDIT THIS SECTION MANUALLY
Var
MIDIin : MidiInBlock
//$

//Called when a CC message is received at some MidiIn block
//The CC numbers must be within the specified range

On ControlChangeEvent(m : ControlChangeMessage) Matching 64 from MIDIin
Var
CCValue : int;

CCValue = m.GetCCValue();

if (CCValue == 127)
Then
MIDIin.SendLater(m, 40.0); //40.0 is the delay in ms
Else
MIDIin.SendNow(m);
End
End

Thanks again,
Hein

I don’t know how you’re triggering the callback but as you’ve written it, whatever channel was used in the CC event that triggered the callback will be sent back out - is your incoming message coming in 6 times on 6 different channels?

If so, do you want it to out 6 times on channel 1 or just once on channel 1?

In any case, you can use the function

 WithChannel(m, 1) 

to set the channel, e.g.

 SendLater ( m.WithChannel(1), 40.0)  // Send the message on channel 1

Hello dhj,
yes, now the message is incoming 6 times on 6 different channels. I don’t need that.
I want it to go out just once on channel 1
So, should it look like this? (sorry for my ignorance in scripting!)

//$
// DO NOT EDIT THIS SECTION MANUALLY
Var
MIDIin : MidiInBlock
//$

//Called when a CC message is received at some MidiIn block
//The CC numbers must be within the specified range

On ControlChangeEvent(m : ControlChangeMessage) Matching 64 from MIDIin
Var
CCValue : int;

CCValue = m.GetCCValue();

WithChannel(m, 1)

if (CCValue == 127)
Then
SendLater ( m.WithChannel(1), 40.0) // Send the message on channel 1
Else
MIDIin.SendNow(m);
End
End

I have no idea why this CC is sent at the same time on 6 different channels, but this is something we have to know to help you. So you want to keep the CC64 127 on channel 1 and delay them, while removing all other CC64 127 on other channels ?

This would give something like that:

//$<AutoDeclare>
// DO NOT EDIT THIS SECTION MANUALLY
Var
   MIDIin : MidiInBlock
//$</AutoDeclare>

//Called when a CC message is received at some MidiIn block
//The CC numbers must be within the specified range

On ControlChangeEvent(m : ControlChangeMessage) Matching 64 from MIDIin    
  If (m.GetCCValue() == 127)
  Then
    If (m.GetChannel()==1)
    Then
      MIDIin.SendLater(m, 40.0); //40.0 is the delay in ms
    End
  Else
    MIDIin.SendNow(m);
  End
End