Mr. Dudeley

Have you ever seen Animusic?

When I was about ten, a family friend came over and brought with him a DVD. It said “ANIMUSIC” on the cover, and despite the cool-looking instrument guy, I was nervous about watching it. You see, I’m kind of allergic to watching movies. Watching a whole movie makes me feel all jumbly and squiggly inside. It makes me feel like someone took my emotions and squeezed the juice out of them, mixed it with lemonade and gasoline, set them on fire, and then put them back in me. My mom had to offer to take me swimming in order to get me to watch “Tangled” all the way through.

So when I learned we were going to watch a movie, I was kind of scared. Based on the title and what our friend said about it, I thought it was going to be a feature-length movie about the drama and creative struggles of a small team as they try to make an animated music video. But I decided to at least give it a try. Standing halfway around the corner. Ready to run away if it got serious.

He put the DVD in. It pulled up a main menu with balls bouncing around. I was puzzled. Maybe this wasn’t the kind of movie I was thinking. But maybe it was, and the main menu was a distraction.

Then he started the video. It showed close-up shots of machinery and instruments. I was really confused. What on earth was going on here?

And then the music started.

Within less than five seconds, my mind changed from “what is going on here?” to “OH WOW THIS IS SO COOL!” And that’s what began my obsession with Animusic.

Almost immediately after I saw it, I began thinking of my own animations. The thing is, I have this really bad habit of dreaming about ideas and never really taking the next step — thinking about how to actually do them. The ideas swirled around in my head for literally ten years before I finally decided to stare them down. And actually make them.

The first step was to learn Blender! (I chose it because it has a Python API. Also, more importantly, I run Linux, and Blender is completely free.) I had some previous experience with SketchUp and ArchiCad from my Architectural Design class in high school, and that was actually a really good way to teach the basics of modeling and navigating around in 3D spaces. I can’t remember where or when I officially decided to sit down and learn Blender — to get over the hump of indeterminate future possibilities — but I do remember the first tutorial I did, which was how to make a TRON city. It was a really good first tutorial for me, because it got me aquainted with modeling and texturing and the Blender way of doing things. (Which is, by the way, very different from SketchUp.)

And then the next step was to learn how to use its Python API. I followed a really simple tutorial, which used a script to spawn in a huge tower of physics cubes (I can’t find the video — sorry).

And then: time to make a music animation!

The song for this video came from an idea which popped into my head one day as I was messing around with a microphone. For the final version, I used Rosegarden to make the MIDI file, and Ardour to create the sound version. I used sounds entirely from the FluidR3-GM soundfont.

Oh yeah, I should probably explain how Animusic works, and why I needed the MIDI file. A MIDI file is just a list of notes in the music. (They contain information about pitch, velocity, and when the note begins and ends.) Since this is just data, and computers are designed to work on data, it occurred to Wayne Lytle (the co-creator of Animusic) that he could write a script to turn the music data into animation data for virtual instruments. The goal is that the instruments look like they’re playing the music. So when you watch an Animusic video, all of the animation you see (with the exception of lights and cameras) was generated from the MIDI files of the songs you hear.

I wanted to do the same thing, which is why I had to learn Blender. (I allready knew Python.)

The first MIDI-related program I wrote was a small script to output the notes used by every track in a MIDI file. It didn’t do any animation, but it was usefull, and it was a good starting point.

The next thing I did was model a stack of Legos with one of those rotating axle joints on top for the laser, and wrote a program to make it move.

Seeing it in motion for the first time was incredible.

From there, I wrote all of the python code used to make this animation (with a lot of help from the Blender Stack Exchange — this answer was especially helpful, as it formed the backbone of my script). It’s called AniMIDI (which is a name my Dad thought of.)

I was surprised to find, while making this, that most of the movement algorithms weren’t actually that complex. For example, the laser just needs one rotation keyframe for when the note starts, another rotation keyframe for when the note ends, and two more keyframes to turn the laser beam on and off. It’s really that simple.

The most complicated instrument in this animation is, of course, Mr. Dudeley himself. (That’s the name of the bassman guy, which is obviously totally not copying a well-known Animusic instrument.) (By the way, Stick Figures is my favourite Animusic song.)

I’m surprised with how many views this has gotten, probably because YouTube lumps it in with all the other fanimusic animations people have done. I would, of course, love it if someone else would use this script (but please don’t use this version of it — version 2, which I used for “Axel F”, is much better), but most people seem to be using MIDIAnimator instead, which came out just a few months before I published this animation. (Man, I knew someone would beat me to it…)

I’m glad that I was able to do this, and I look forward to being able to make plenty more of these in the future.

I’ve included a download link of the source files, which contain the .blend file for this animation, a copy of animidi.py, and the MIDI file for the song, if anyone out there wants to take a look at it. If you do, please remember that all Python code contained in animidi.py, note_spread.py, and the .blend file is free to use, modify, or distribute for any purpose. All other content in the .blend file, and Mr_Dudeley_05.mid, are licensed under CC-BY-SA 4.0, except for the image textures “seamless-wood-background-1.jpg”, “seamless-wood-planks-2.jpg”, and “seamless-wood-planks-5.jpg”, which came from myfreetextures.com, and use that website’s license. Enjoy!

Download link: mr_dudeley.zip

Leave a comment