Nothing terribly fancy today, but I found something I made a while ago and figured I’d share it. If you’re a fan of Call of Duty 4: Modern Warfare, it’s very likely that you’ve seen the teaser trailer for the sequel that was released back in March.
In the trailer, pretty much all you see is a green line that reacts to audio, and occasionally pieces together an image. I thought the effect was pretty slick, and wanted to try and recreate it a little bit. About 15 minutes later, I had something passable, that was kinda fun to watch:
http://www.ghostradio.net/flash/mw2/
As you can see, I didn’t go full-blown and recreate everything, just the green line that reacts to the sound, and I added a bit of glow and fading effects. It’s actually a really simple effect that looks pretty decent, without a bunch of code.
The line reacting to the sound is part of the sample code from the documentation for SoundMixer.computeSpectrum, so you can find a more detailed explanation of what’s happening with the audio there.
For the blurring and glowing effects, all I’m doing is grabbing a snapshot of the green line, and redrawing it with a bit of blur and a glow. By repeatedly blurring it, eventually the snapshot of that line starts to dissolve away.
I’ve posted the source for this as a Flex Builder 3 project you can download here: http://www.ghostradio.net/flash/mw2/mw2trailer.zip
Again, nothing super special, but still kinda fun to play with.
Audio: Call of Duty 4 Gun Sounds by Serpento, video on YouTube.


