Drum machine

Here’s my drum sequencer. It keeps its timing because it’s writing directly into an audio clip to create a whole track’s measure (actually two measures, single-buffered) on the fly as changes happen to the sequencer. The audio timeline is one of the most accurate timing mechanisms in Unity.

I’ve updated for the latest SDK and used variable syncing / ownership transfer so that multiple players can jam together.

It’d be a great basis for lots of group jamming ideas, and adding visualizations to the steps would be really straightforward to do (no need for GetSpectrumData, just trigger an effect on the step!)

The basic layout for each track:

  • root object that holds the sequencer graph: this examines the state of child objects to build the single-buffered track waveform from the given sample.
  • step object that holds the interaction graph: this handles the click on click off and enable/disable for the visual objects

There’s also a disabled SeqStart object because I thought I might have to trigger all the track clips to start at the same time to maintain their sync. It seems to not need this, so each track starts on its own (presumably on the same frame as the other tracks). I think if you make many more tracks some would end up starting on later frames and probably not be in sync.

The world is published here:

Unitypackage here:

next project: 4-op FM Synthesis!

3 Likes