Audio Player Triggering Song Parts

Currently I am using Stage Traxx to play backing tracks. In stage tracks I can define midi commands to be sent based on the playhead position of the WAV file. So I am triggering song parts in GP based on time (in minutes and seconds) as the WAV files plays. It works well, but I would prefer not to have to run multiple apps.

I am trying to get the same functionality using GP’s Audio Player. But I can’t figure out how to get the audio player to trigger song parts at desired times in a single WAV file used as a backing track.

It looks like this may be possible using the midi metronome in Audio Player, but I haven’t been able to figure it out. Any help would be appreciated.

1 Like

Better is to use the callback
On BeatChanged

Just press the global play button and in this callback you can react on every beat

Thanks for the feedback and the link to the other thread. I was able to get this script working.

on BeatChanged(bar : integer, beat : integer, subbeat : integer)
if bar == 1 then
 SetSongPart(0)
elsif bar == 17 then
 SetSongPart(1)
elsif bar == 37 then
 SetSongPart(2)
elsif bar == 57 then
 SetSongPart(3)
elsif bar == 72 then
 SetSongPart(4)
elsif bar == 92 then
 SetSongPart(5)
end
end

The only issue is that the changes are not precise. The midi clock is not exactly synced with the wav file that’s playing in the audio player plugin. It’s close though. I think if I could add additional beat information along with the existing bar information, I could get the precision I am looking for.

Any ideas on what the syntax would look like?

Also, I would like to add a statement at the end, that is also triggered by beat and bar information, but that allows me to mute the song part. I could make a PC work for the muting if I understood the syntax.

Oops, you should really react on bar.beat
In your script you change every Song Part 4x as the bar remains the same and the beat goes from 1…4

Change it to

on BeatChanged(bar : integer, beat : integer, subbeat : integer)
   if beat == 1
     then
        if bar == 1 then SetSongPart(0)
           elsif bar == 17 then SetSongPart(1)
           elsif bar == 37 then SetSongPart(2)
           elsif bar == 57 then
              ///.... etc. etc
         end  // bar test
   end // Beat test
end // callback

This works great, thanks. Gives me a bit more control too.

I’m trying to embed a program change message in here too. I’m thinking this may work, but I don’t know the syntax.

GetProgramChangeNumber(m: ProgramChangeMessage ) Returns Integer
Returns the program change number of a ProgramChangeMessage MIDI event
Parameters
m (ProgramChangeMessage)
Return type Integer

Or…

MakeProgramChangeMessage(value: Integer ) Returns ProgramChangeMessage
Returns a new ProgramChange MIDI message with the specified value ranging from 0 to 127. The MIDI channel is 1

 Parameters:  value (Integer)
 Return type: ProgramChangeMessage

I decided to create a muted variation and just apply that to the last song part. It gets triggered by GSscript as noted above as an additional songpart. I trigger it at the last second of the song so I’m muted when the song ends. Works fine.