Skip to content

Procedural Soundtrack

I made a quick example of a realtime generated procedural soundtrack using the Unreal 4 Engine and SuperCollider.  First task was to have the Engine communicate with Supercollider. Because SC is heavily based on OSC communication between the language and sound server i went looking for an existing OSC plugin for UE4. I downloaded one from here.

After some fiddling i managed to compile the source code and got the plugin working inside UE4. The engine is very newb-friendly: most non-trivial tasks can be done in a node editor without having to code anything. So i managed to setup a small world with some hills and a bunch of box triggers within a few hours. Besides used as collision triggers you can also calculate the relative position of the character towards each box. I made a setup of 6 boxes, the relative position is pushed together with the characters’ absolute XYZ position as 9 floats into an OSC message string:

blueprint

In Supercollider i parsed the message using an OSCdef function into global variables:

OSCdef

which i used into a simple SC-composition to modulate some levels, envelopes and FM modulator oscillators. The characters’ Z-position controls several lowpass filters. All sound is generated with SuperCollider. I recorded a screencast to give an idea of the results:

It is a simple example but this could be expanded into something much more complex. i also believe that procedural soundtracks will become more important in videogames and other interactive digital content. Especially with computers getting powerfull enough so there is more room for realtime generated/synthesed audio besides the game or other main content.

back