WARNING: HARDHAT AREA
This page is undergoing renovations at the moment. All the links still probably work, but most of these words have to go.
Except for maybe "the". That's a pretty useful word.
Except for maybe "the". That's a pretty useful word.
An Audio-Based Extension for Unity3D
Coda contains functionality for analyzing and interpreting songs in a way that makes it easy to add audio-reactive elements to a Unity3D project. Objects can be programmed to move, check an input, or do just about any other function on the beat with relative ease right out of the box.
Tracking Beats
This is the part of the framework I was responsible for. The Maestro object is a prefab located in the Coda/Prefabs directory. By simply adding the Maestro to a scene, inputting the audio clip you wish to play, and selecting the beatmap you wish to track, you can have any objects you want execute code on or around the beats of the song.
The Maestro acts as a singleton (there should only ever be one in any given scene), which allows any script to access its properties and methods so long as there is an instance of it present. A script that inherits from Coda.MusicBehaviour instead of MonoBehaviour will automatically subscribe to the Maestro singleton. All a developer must then do to have code execute on any given beat is write an OnBeat() override function in the desired script. Any code in the OnBeat() function will be called by the Maestro when it reads a beat from the supplied beatmap.
In addition to managing the subscribed MusicBehaviours, the Maestro contains a variety of properties and methods to retrieve information about the next, previous, and closest beat to the current frame. These functions allow for easing in and out of the frame on which a beat happens, instead of executing code only on a single frame. Subsequently, in conjunction with the Timing enum, these functions are what make rhythm games possible.
The Maestro acts as a singleton (there should only ever be one in any given scene), which allows any script to access its properties and methods so long as there is an instance of it present. A script that inherits from Coda.MusicBehaviour instead of MonoBehaviour will automatically subscribe to the Maestro singleton. All a developer must then do to have code execute on any given beat is write an OnBeat() override function in the desired script. Any code in the OnBeat() function will be called by the Maestro when it reads a beat from the supplied beatmap.
In addition to managing the subscribed MusicBehaviours, the Maestro contains a variety of properties and methods to retrieve information about the next, previous, and closest beat to the current frame. These functions allow for easing in and out of the frame on which a beat happens, instead of executing code only on a single frame. Subsequently, in conjunction with the Timing enum, these functions are what make rhythm games possible.
Interested in trying it out for yourself?
Yes, the demo with the dancing robots is included in the Unity package. We know you want it.
|
Unity's Web Player unfortunately doesn't work in Chrome, so you might have to open in Firefox.
|
If for whatever reason the Unity package isn't good enough for you or something.
|