Skip to content

Example: Send OSC message on each beat

James Elliott edited this page Oct 9, 2018 · 3 revisions

Example: Send an OSC message to a destination (Resolume, Chamsys MagicQ, etc) on each beat

I (@drummerclint) use this expression to sync lighting and video effects to the beat of the music. This particular example is used for Chamsys MagicQ and triggers some automation macros which map to "PB tap to time" for specific playbacks. The Resolume example is listed at the bottom as well.

"localhost" designates the hostname of the current machine (Beat Link Trigger and MagicQ are running on the same machine in this case). In the MagicQ Setup page, under the Network tab, you will need to ensure that OSC mode is set to either "Rx" or "Tx and Rx" and the OSC rx port matches the one listed (ie, 8000). Note, for some reason, MagicQ doesn't reuse OSC messages for multiple commands, hence why I'm sending multiple messages.

Setup Expression:

(swap! locals assoc :chamtap (osc/osc-client "localhost" 8000))

Beat Expression:

(when trigger-active?
  (osc/osc-send (:chamtap @locals) "/tap1")
  (osc/osc-send (:chamtap @locals) "/tap2")
  (osc/osc-send (:chamtap @locals) "/tap3")
  (osc/osc-send (:chamtap @locals) "/tap4")
  (osc/osc-send (:chamtap @locals) "/tap5"))

Shutdown Expression:

(osc/osc-close (:chamtap @locals))

Here's the Beat Expression used for Resolume 5 (in a separate trigger, where you'd replace :chamtap with :restap, as well as the hostname/ip and/or port number):

(when trigger-active?
  (osc/osc-send (:restap @locals) "/playbackcontroller/tap" 1.0))

Here's for Resolume 6:

(when trigger-active?
  (osc/osc-send (:restap @locals) "/composition/tempocontroller/tempotap" 1.0))