Antti Kupila

Personal Blog, Portfolio and Online playground

Bryant Street, San Francisco, CA

Revolt, actionscript 3 based spectrum analyzer source released

I have decided to release the source code for Revolt, a flash spectrum analyzer I made back in July 2006 (jeesh, the time flies!). I know I’m a bit late, but you know, it’s 2007, it’s time for actionscript 3!. I will also consider this as my really late Christmas present to you, my dear readers, so don’t expect any candy after this, ok? Good :)
The image below is a screenshot from it. View the spectrum analyzer in action

Revolt, flash based spectrum analyzer screenshot

Anyway, actionscript 3 is really cool and compared to actionscript 2 even more logical and structured. I can definitely recommend anybody working more or less professionally with flash to take a look at it. If you know actionscript 2 and words like “oop”, “encapsulation” and “polymorphism” don’t sound like hebrew, it won’t be hard to get into it. Ok, I know Flash 9 isn’t out yet (the beta is), but will be soon, and the penetration of the flash 9 player is growing day by day (View stats), so we can quite safely start using it soon. Too bad I just haven’t had time to play with it more.

I could also mention one thing I found after switching to mac: the public beta does not work on intel macs. It runs, but crashes when publishing (some java thing). That sucks. Luckily as this mac has a heart (or brain?) made by intel it will run Microsoft’s Windows without problems. As I mentioned I haven’t had time to play that much with actionscript 3 recently, but found out that using the beta under windows with Parallels Desktop is really handy, and almost as good as under OS X (if not even better, as it’s even faster than Flash 8 under OS X (this being since it’s not a universal binary to you who have lived under a rock the whole 2006)). When using Parallels in coherence mode I can use the Flash 9 alpha preview just like Flash 8. Sweet!

Another Revolt screenshot

Anyway, I’m sure you’re not reading this to find out how I work.
You want the source, the good stuff.
The bits and pieces that build up the project I like to call “Revolt”.
Fine, I won’t keep you waiting.

Download the revolt source files (now working in CS3)

What this does is that it analyzes the frequencies of a mp3 file and visualizes it using presets that consist of different combinations of so called drawers, effects and scalers. It comes with 6 presets built in and making your own is really easy, since the engine is done. View the source of a preset and give it a try!

As with some previous source I’ve released, this goes out under the CreativeCommons Attribution-ShareAlike 2.5 license.

I have to mention that the song is not included with the download. This is due to copyright issues. Just put any mp3 in the same folder and rename it to song.mp3 (or change the path/filename in the .fla) and it’ll work just fine.

Now what are you waiting for? I want links to your cool visualizers! :)

Update! When I wrote Revolt, Flash CS3 was just a buzzword. Not that it’s out, i also noticed it’s a bit different than the alpha. I have now fixed the source and tested it in CS3, it’s now fully compliant!

Comments

46 Comments
  1. 2007-01-29, 7:45 by My2Bits » Blog Archive » Awesome AS3 Audio Spectrum Visualizer

    […] Kupila has written a great ActionScript 3 Spectrum Analyzer library for Flash/Flex.  Check out a demo of the  visualizer here.  He’s also released the library […]

  2. 2007-01-29, 9:57 by Francesco

    It’s really cool !!! nice job….and the song is really nice….but who’s the artist and the title of this song? :)

  3. 2007-01-29, 10:02 by Antti Author comment

    Thanks :)
    The song is Suburban Tribe - While The World Awaits

  4. 2007-01-29, 15:11 by Mike J

    Very nice! I’ve been sitting on some visualizer code myself that I meant to release but haven’t gotten to it yet!

    http://divshare.com/download/82823-d5a

    Maybe I should take this as a sign to get off my hindquarters and release it! =D

  5. 2007-01-30, 8:44 by koen de weggheleire

    This was an spectrum visualisation experiment i did made with bitmapdata, source is also available:
    http://newmovieclip.wordpress.com/2006/12/28/bitmapdata-spectrum-visualisation-experiment/

  6. 2007-03-11, 19:49 by Ahmet

    Nice one.

    Here is mine, based on the Perlin Noise ;)
    Perlin sound visualizer

  7. 2007-03-12, 11:11 by Revolt - AS3 spectrum analyzer - just Awesome - With Source code « Flash Enabled - Get Ready With Flash…

    […] Check the entire post and source here. […]

  8. 2007-04-09, 10:31 by swallow

    wonderful! thank you beautiful work!

  9. 2007-05-15, 12:49 by AS3 sound visualisation

    Goos stuff! very smooth.

    Heres my Actionscript 3.0 sound visualiser using animations.

  10. 2007-05-18, 16:19 by Open source put to good use – Antti Kupila

    […] Noticed today that a new “web 2.0” app iden.tify.us is using my Revolt visualizer in their player. […]

  11. 2007-05-21, 12:29 by DougStudio

    Sorry the example should be http://www.dougstudio.co.uk/spectrum_fft_on/

  12. 2007-05-28, 1:16 by Erik Lembke

    My respect, really nice effects. I like especially the red and green bars. I’ve also done some work with the ComputeSpectrum-method of AS3 with my “Spectrum Orchestrator”.

    http://www.unic8.com/en/news/labs/spectrum-orchestrator.html

  13. 2007-05-31, 21:47 by Adam

    Hello and congrats for this exellent work.

    Would you happen to know why when I open the Revolt.fla file in Flash CS3 and compile the file I get 100 Compiler Errors reported with a total of 142 ActionScript Errors?
    It starts bu the SoundProcessor with line 1,6,7,8,9
    Then Preset….Drawer….Line….Effect…

    Thanks a lot in advance.

    Regards,

    Eric.

  14. 2007-06-01, 8:39 by Antti Author comment

    Eric: I’m guessing you’re trying to compile in Actionscript 2?

  15. 2007-06-01, 14:36 by Adam

    Greetings,

    Thank you for your prompt response. My appologizes, yes I did load it in CS3, but to me it was obvious that it would compile as ActionScript 3.0

    So I did start over with new source files, switched the compiler to AS3, and now I’m getting 22 Compiler Error. It starts with:
    - Preset.as Line 32 Warning 3596:Duplicate variable definition for (var i in _effecs){
    - Preset.as Line 35 Warning 3596:Duplicate variable definition for (var i in _drawers){
    - Tint.as Line 25 Warning 1096…..
    and to end
    - All classes with error code 5001: The name of package ” does not reflect the location of this file…..

    Thanks again with your support and sharing this awesome work.

    Regards,

    Adam

  16. 2007-06-04, 14:20 by voidSkipper

    Sounds to me like you need to put some class and include files in the same directory as the fla

  17. 2007-06-09, 9:24 by rudi

    Don’t work in new flash cs?!

  18. 2007-06-09, 12:13 by Antti Author comment

    rudi, Adam and all the others of you who have had problems with CS3, it works now :)

  19. 2007-06-18, 21:45 by fkuxxbytml

    Hello! Good Site! Thanks you! zyhkehgajoupm

  20. 2007-07-02, 7:51 by Kosa

    Is this library included in the source code? “com.anttikupila.revolt.controls.CPanel” Because when I’m trying to run the application it trhows some errors. For the rest of the code is pretty neat and well organized. Thanks!

  21. 2007-07-09, 10:18 by Antti Author comment

    Oh I’m sorry Kosa, the CPanel isn’t inclucded - but isn’t needed either. I removed the line and updated the zip.

  22. 2007-07-27, 13:36 by flash lover

    for Eric Lembke…………….

    Plz show me how to make these bars animating up and down

    kimo

  23. 2007-07-31, 11:32 by smartkit

    Very nice & easy to apply in Flex2.

  24. 2007-07-31, 15:36 by Pedram

    By far the very best visualizer, a nice job, I can’t believe you rocked out such a nice audio abstraction library before CS3 had even left beta!. This is GREAT!!!

  25. 2007-10-15, 19:13 by Andrew

    This is the best spectrum viewer I have ever found on flash, well done!

    1 question though

    public function getLeftChannel(fourier:Boolean):Array {
    SoundMixer.computeSpectrum(ba, fourier, 0);
    return getSection(ba, 256);
    }
    public function getRightChannel(fourier:Boolean):Array {
    SoundMixer.computeSpectrum(ba, fourier, 0);
    ba.position = 1024;
    return getSection(ba, 256);
    }
    public function getSoundSpectrum(fourier:Boolean):Array {
    SoundMixer.computeSpectrum(ba, fourier, 0);
    return getSection(ba, 512);
    }

    So readFloat return a floating point number from the byteArray that has a length of 2048. Thats why you position it to 1024 when looking at the right channel, but why do you use 256 as a sectionlength value? I couldnt figure it out how this value comes from.
    Thanks

  26. 2007-10-16, 4:48 by Antti Author comment

    Andrew: since floats are read we need to divide the amount of floats read by four since one float is 4 bytes. So, reading 256 floats will result in the same length as 1024 bytes.

  27. 2007-10-17, 22:59 by AS3 声音频谱分析器演示及源码下载 « Developer’s Research Center

    […] 点击观看在线演示 源码下载:the revolt source files 相关文章: Revolt, actionscript 3 based spectrum analyzer source released […]

  28. 2007-10-24, 8:17 by Projekty domow

    Hi
    This is free analyzer?
    Best Regards

  29. 2007-10-24, 8:21 by Antti Author comment

    Yes, free. Licensed under CC.

  30. 2007-11-11, 21:39 by Matt

    This is great I use to my top image… Can I play only files? or all music in system?
    Sorry my english is easy..

  31. 2007-11-16, 23:20 by Sound spectrum analyzer in Flash — Knut Urdalen’s Blog

    […] Kupila has written Revolt, an ActionScript 3 based spectrum analyzer. In addition to use the the computeSpectrum() in a sound processor class it contains drawers, […]

  32. 2007-11-17, 1:21 by Cleaning up the Revolt source — Knut Urdalen’s Blog

    […] not sure if I got the latest source of Revolt, however I just cleaned up the Revolt source code so it compiles with strict mode in ActionScript […]

  33. 2007-11-28, 3:24 by smartkit

    Look this :http://www.freehere.cn/MyLab/MusicEffect/
    Use this free analyzer with Flex.

  34. 2008-01-01, 14:21 by arsenik

    are you going to provide documentation or not?

  35. 2008-01-01, 15:03 by Antti Author comment

    arsenik: not for this version, possibly for some future release

  36. 2008-01-28, 4:47 by Goran Grubic

    Hello!

    Great source. I had to fix some errors occured during compilation but it works great.

    When you look at code it’s obvius that you adapted it from AS2, since there are many more elegant way to do some things in AS3… I’m suggesting rewriting, maybe by someone of us, because you’ve done already enought :)

    Best wishes!

  37. 2008-01-28, 6:46 by Antti Author comment

    Hey Goran

    Yeah, i know the source is not perfect. It is pretty close to the first thing i did in as3, far before flash cs3 was released. I’ve thought about rewriting stuff but as this was a funny little personal experiment done on during a weekend the summer of ‘06, i probably won’t.. Feel free to do it yourself if you feel like it :)

    thanks

  38. 2008-02-07, 16:22 by haz

    hey

    sorry to be stupid, but please could somebody post up a short code example for implementing this in flex?

    tia

  39. 2008-02-15, 2:04 by Londynek

    Thank you! Very nice and interesting article.

  40. 2008-03-01, 0:22 by Wojtas

    It’s really cool !!! nice job….and the song is really nice….but who’s the artist and the title of this song?

  41. 2008-03-18, 10:52 by Londi

    Thank you for the good articles have helped me a lot.

  42. 2008-03-18, 11:15 by Londis

    I love this post!

  43. 2008-04-24, 16:48 by Alfonso

    Antti, this is the best spectrum analyzer out on the web by far! thank you for the release! I have a question! I’m trying to make this the background of an MP3 player. I’m still new to AS3, but where and how would I make a simple stop button to stop the music and the spectrum Analyzer? Thank You once again!

  44. 2008-04-24, 17:16 by Antti Author comment

    Alfonso: You can normally play and stop the music, and it will stop the input to the spectrum too since flash analyzes everything that goes out. Changing the volume on the music will also automatically make the visual effects more subtle. http://tinyurl.com/5vk2d9

  45. 2008-05-03, 22:40 by 小山太郎.com » Blog Archive » Flash 気になるリンク集

    […] FlashでiTune Visualizerのようなものを http://www.anttikupila.com/flash/revolt-actionscript-3-based-spectrum-analyzer-source-released/ […]

  46. 2008-05-15, 17:15 by Demo - Visualización de Sonido con ActionScript y PaperVision3D « Shift F12

    […] Revolt, actionscript 3 based spectrum analyzer source released (con código fuente incluido!) […]

Post a comment