I have a midi file player block going into a drum sampler with 2 different drum beats programmed in the midi files, all in the global rackspace. Call the midi files X and Y respectively. I have file X going, and when I switch to a specific rackspace, I have gig performer set up to play file Y on the switch.
How it works now is file Y plays immediately on the switch, but because these rackspaces are part of a specific song, I’d like to have the midi file player wait until count “1” or “3” to switch so it sounds like the drum sound is changing seamlessly in time. Right now, the change happens immediately meaning unless my timing on switching to the new rackspace is perfect, the change is not seamless. Is there any way to get the midi file player to switch “in time” to keep everything locked down?
If not, can anyone recommend an alternate method of accomplishing what I’m trying to do?
script in global rackspace.
The trick is to use an additional Widget in the Global Rackspace.
The existing is only for synchronization between the local and the global rackspace.
When the widget is changed it set the variable trigger to true.
In the OnBeatChanged callback it is checked if trigger == true and
beat == 1 and the 2 widget do not have the same value => set the 2nd widget to the value of the 1st widget.
Var
K1 : Widget
K2 : Widget
trigger : boolean
//$</AutoDeclare>
// Called when a single widget value has changed
On WidgetValueChanged(newValue : double) from K1
trigger = true
End
// Called when beat changes
// Only beat number is valid for now
On BeatChanged(bar : integer, beat : integer)
if beat == 1 and trigger == true and
GetWidgetValue(K1) <> GetWidgetValue(K2) then
SetWidgetValue(K2,GetWidgetValue(K1))
trigger = false
end
End
Wow thank you so much @pianopaul! This works like a dream.
This was a pretty clever way of implementing this. Only issue I had was that I was hoping it could change on beats 1 or 3, but I got around this by setting the time signature of the 1st rackspace to 2/4 so beat 1 would land on counts “1” and “would-be 3.” Similarly, even though the two drums beats have the same global tempo, I had written the second drum beat with subdivisions to have a 4 over 3 feel, where the cycle was 3 beats long. Since I wanted the change to drum beat 1 to come back in on their common “1” count, I changed the second rackspace to a 3/4 time signature and the script works perfectly.
Also, out of curiousity, I was seeing if I could keep the time signature in the 1st rackspace in 4/4, and changed the script on line 17 to read
if beat == 1 or 3 and trigger == true and
but I got a semantic error when compiling. Probably should’ve known better than to try to take a shortcut and not expect an error. If I did want it to change on either beats 1 or 3 (depending on which came first), any idea how I could accomplish this?
No need to answer if it would require a whole new script. You’ve already helped me out immensely and what you’ve given me works flawlessly. Thanks again!
Great, thank you! Obviously I’m not much of a coder but it seems I keep coming up on certain functionalities where scripting would come in handy, so I might have to sit down and finally teach myself.