How to trigger samples

That’s exactly what I wanted to say, except that I’m not expressing myself properly because I don’t know anything about scripting and all that goes with it.

I’m using a new MIDI footswitch controller, but it is a momentary footswitch that triggers the action when pressed and again when released.
Is there an equivalent to “IsNoteOn” for a controller in the script?

Or is it possible to use a widget to trigger the action by assigning “Momentary to Latching” to the footswitch?

What exact messages are sent from your controller when pressed and released?

CC24 127
CC24 0

This is the script I published earlier:

gp-trig-script

OK, but what CC values are sent when you press and release the controller?

CC24 127
CC24 0
Iit is a momentary footswitch Boss FS-5U

OK, so you want the code be executed when the value 127 is sent?

yes 127 is the best (is the most responsive)

For controllers, you can test the CC value and only respond if he value is 127

function GetCCValue (m : ControlChangeMessage) returns Integer

So instead of IsNoteOn you would write

GetCCValue(m) == 127

Edit: I see good old @pianopaul provided a full example

1 Like

Change the script this way:

On ControlChangeEvent (c : ControlChangeMessage) matching 24 from TRIGTRACK
 if GetCCValue(c) == 127 then
  SetWidgetValue(TRACK[TRACK_playing],1.0)
  TRACK_playing = (TRACK_playing + 1) % Size(TRACK)

  SetWidgetValue(PLAY, 1.0)
 end
end

I copied and pasted to make sure I didn’t make a mistake and I’ve got this error:

TYPO

use size instead of sized

same error with size

OK, Size not size - my fault

It’s working! Well done and thank you all :slightly_smiling_face:

1 Like

The next step is to upload an example fully working gig file :innocent:

Since I brought this topic up, I’ve tried to keep up with all the great info you guys have graciously provided. However, I’m still kinda in the dark as to what’s happening. Keep in mind I’ve never done anything using scripts. And only a couple days ago tried using the audio file player, which I did manage to get mapped to a widget and able to trigger basic samples. Please direct me from the beginning. I copy (or write), the script that Hermon posted where? Where do I enter it? In the panel edit view script tab? That would seem logical. What are the rest of the steps to get this working? I’d like to trigger successive samples with the pads on my controller.

Do you know this?
https://gigperformer.com/docs_5_0/LanguageManual/

It is already written in the .gig file updated here:
Trig-Oneshot-by note.gig (503.3 KB)

Then follow the same procedure as in my previous post accompanied by a screenshot.

2 Likes

Apologies if I just missed this somewhere earlier in the thread, but is it possible to assign a key on a keyboard to a sample in the Audio File Player so that the sample is “on” with MIDI Note On (key pressed) and “off” with MIDI Note Off (key released)? I’m trying to play the DTMF tone in the song Never There. I’ve got the dial tone at the beginning. That’s easy since it’s just played once. Maybe Audio File Player isn’t my best solution, but Decent Sampler, which I know nothing about how to make it work in that.