Well it’s been a while since I’ve done a blog post, the last I wrote I was trying to keep a daily blog up and failed on the second day. I must say, blogging doesn’t come natural to me, but when I have lots of ideas to think about I need a repository to store these ideas, so it’s definitely something I need to get into…
I had the urge to write a post a few weeks ago regarding folio preparation, but didn’t get around to doing it. It’s definitely something I want to write about soon as I think it’s an important topic. A little update about what’s going on with myself… I’m working as a 3D and Multimedia tutor at Curtin University in Perth, Western Australia. Have been doing that for a couple of years and I’m settling in pretty well and enjoying the education aspect. Other than that, my freelance is just heating up. I have some decent size jobs going on and some sizzling clients and contacts that will definitely propel my business in the right direction. Enough about that!
The experiment
When working on a lot of work related things, it’s good to procrastinate sometimes to relax, and what better thing to procrastinate with than playing around with some 3D dynamics. Not particle, or cloth or anything like that. I’ve always wanted to play around with audio driven 3d animation, so I gave it a go on the weekend. This is my result:
As you can see, the line bounces to the audio track. It’s not perfect, but its a start, and a decent result for one days messing around. It’s actually a cool starting point and I can imagine what cool stuff I can animate to a wav file. Currently that’s just an extrude based on the value output from the audio file, mapped over time, but imagine using the output values for colour changes, other animation changes, particle emission changes etc.
How it’s done
It’s driven off the plugin downloadable off area.autodesk.com called ‘audiowave.mll’. Here’s the basic set-up…
createNode audioWave;
- This creates a node called audioWave1. It’s what you hook the wav file into. I just executed each MEL script after each line to make sure it was done correctly.
connectAttr soundNode.filename audioWave1.audio;
- Where ‘soundNode’ is the file name of the audio clip. You can find this out if you aren’t sure by right clicking on the timeline where the audio is placed, and hovering over the sound option. It should tell you the audio file reference name.
connectAttr time1.outTime audioWave1.input;
- This hooks the audio wave up to the timeline, so the value changes over time.
From here you’ve hooked up the audio to the audioWave node, and also hooked it up to the timeline. What this will do is it will output various values ranging from 0-1 for the wave sign position in the timeline. You can now use this value to animate different elements of a model or texture. It’s the driver for the animation. For the animation you see above, I have animated the subcurve extrusion attribute. This is how it was hooked up:
connectAttr audioWave1.output object.attribute;
- Use whatever attribute you want to animate. If you are unsure of the attribute name specifically, you can right click on the attribute and go to create an expression, and nab the attribute name in that window. The only reason I did it this way is because I am pretty much clueless about MEL.
The most noteworthy thing is, once you are happy with the animation produced from linking the attributes up, I noticed that you had to bake the keys for it to render in batch render. Not sure if this is supposed to be part of the process, but I found that this allowed it to be rendered. I noticed the bake only worked if the object baked was the one directly affecting the animation, so in this case the subcurve value.
All that aside, you have now linked up the audio to a wave control node, and now hooked the wave results into an animated attribute. Another quick note is you can use nodes to amplify the results. For example, I hooked an audio clip up to the luminance value which isn’t easily seen, but the luminance value isn’t effective in casting light/shadows at low values which are output by the wave node (eg. 0.75 etc), so by putting a multiplier node and multiplying the value by 10 or 15, you get more of an effect.
What’s the use of it?
So as you can see, now you’re getting a result from the audio peaks/troughs, what’s animatable is only left to your imagination. My next thought was splitting audio waves into highs, mids and lows and animating different elements, such as colour, size, even particles. Set driven keys, anything you can think of. Could be useful for audio decoding and even initial mouth/character animation based off voice.
The animation has LOTS to be refined on, such as motion blur etc, but the concept is there…
I intend to tweak this and play with this a lot more in the near future with different animated elements, so hopefully I’ll keep this blog updated with progress.