DiscOSC
This chapter uses OSC queries to construct a traditional three-band sound-to-light system. The example animates a video image consisting of six sprites, but it is easy to adapt this method to control lighting levels or nearly any parameter of any cue in QLab.
Here it is in action, best viewed full screen:
How it works
A Group cue set to “start all children simultaneously” contains three Audio cues that all target the same audio file. Each cue has an AUBandpass filter applied in the Audio Effects tab of the inspector. In one cue, the bandpass is centered around 4100 Hz, in another it’s set to 768 Hz, and in the third it’s set to 148 Hz.
Another Group cue contains several Network cues, each of which query the Audio cues using liveAverageLevel
to get an instantaneous level reading. Depending upon which Audio cue they query, they get a reason for the high-, mid-, or low-frequency content of the target audio. The level is then used to modify geometry parameters of Text cues which use emoji to make a picture of a weird face. In an actual show, you’d probably use Video cues displaying PNG images with alpha transparency, but the example workspace uses emoji for compactness.
Here’s one of the OSC queries used in the workspace:
/cue/LOM/scaleX #/cue/LO/liveAverageLevel/1 1 20#
This message animates the x scale of cue LOM
(the eyeballs) by getting the average level of the cue numbered LO
(which has a bandpass filter applied to isolate bass frequencies). The query ends in three numbers; the first is the cue output that’s measured, and the second and third number represent the minimum and maximum range that the level is scaled to. Therefore, when the level of cue output 1 of cue LO
is silent, the query will return 1
. When the level is as loud as is possible, the query will return 20
.
Music in Demo Workspace: “Stringed Disco” by Kevin MacLeod (incompetech.com). Licensed under a Creative Commons Attribution 3.0 Unported License.