Whenever I watch a video introducing an automatic factory, I can always feel the beats of the sound generated by those machines. They are periodic and regular. So, why not build a sequencer formed by the machines!

This factory not only produces cupcakes, but it also produces SCHWIFTY sounds! Let’s get schwifty!

This is the homework of MUSIC 256A (CS 476A) at Stanford University.

Introduction of the Machines

There are four machines, and each of them serves a specific function. All of them have four wheels, and each wheel contains four pedals. Each pedal equals one beat, so there are totally 16 beats in a cycle. Every pedal has five different choices (different color means different selection).

The rightmost one produce the cupcakes in different sizes. The size will determine the frequency of this cupcake. All the other machines do not produce cupcakes, but they add some special ingredients to the produced cupcakes. The second machine change the waveform of the sound. The third one changes the octave from -2 to 2. The last one creates special effects and ‘surprising’ sound to the cupcake.

You can select the rolling cylinder of the machine to edit its pedals. The keys ‘1’, ‘2’, ‘3’, ‘4’, ‘Q’, ‘W’, ‘E’, ‘R’, ‘A’, ‘S’, ‘D’, ‘F’, ‘Z’, ‘X’, ‘C’, ‘V’ correspond to different pedals.

Press the right-top button to start the machines. When the pacmans on the left eat the cupcakes, they will generate the sounds!

Here is a demo video.

Technical Issues

  • This program is powered by Unity and ChucK, and the code was written in C#.
  • Since it is a physical model, every subtle force or velocity might affects the tempo. Therefore, I created a synchronizer to keep every generated sound on its right beat. The synchronizer will cache the sounds that arrive too early and somehow predicts the delayed sounds.
  • The conveyor is composed of some rolling cylinders rounded by long flat cubes that are connected through hinge joints. I added some torque to the cylinders, and there is a large fiction between the belt and the cylinders so that the belt can move.
  • All the sound, except for the machine cracking sound and the schwifty music, are generated by ChucK.
  • To use ChucK in Unity, please see the Chunity reference.

Download the Source Code

You can download the whole Unity project through my Github or type the following command in your terminal.

git clone https://github.com/tweihaha/cupcake-sequencer.git

Load the project through your Unity. It should not have problem between different operating systems.