Antti Kupila

Personal Blog, Portfolio and Online playground

View over the green room at Sid Lee, Montreal

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

89 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!) [...]

  47. 2008-05-23, 0:27 by JJ

    I tried to get your *really nice script :-) * working with audio streams
    but I found that it doesn’t work with a stream, it only works with plain.mp3 files
    (p.s. local it play’s fine with a stream but when I put everything online it will just draw the first object/line and then it stops ? )
    I can’t figure out what/where to start debugging …

    Have you tried any audio stream as input ?

  48. 2008-06-02, 17:29 by taikin

    very cool

  49. 2008-06-03, 4:50 by Adobe - Make some noise « I Love Flash

    [...] sound, including pitch control, tempo control, EQs, etc. A few days ago I was researching a few audio visualizers and made several [...]

  50. 2008-06-24, 22:10 by Tutorials | Great How-to Articles on Create Audio Spectrums with AS3 « Flash Enabled Blog

    [...] Link 1 [...]

  51. 2008-08-23, 10:44 by Min Thu

    Cool! Thank you for sharing source files.

  52. 2008-09-28, 21:33 by WillCorn

    Hi, can i use revolt with my own shoutcast radio (on my own server)?

  53. 2008-09-28, 21:53 by Antti Author comment

    WillCorn: Yes.

  54. 2008-10-03, 4:57 by 宁静

    呵呵..很高兴见到这么优秀的作品.
    非常感谢跟我们一起分享.我正在学习AS3.一个很好的学习范例.真棒!

  55. 2008-10-04, 4:06 by 888958

    presetList=new Array(LineFourier,LineNoFourier,Explosion,LineSmooth,LineWorm,Tunnel,
    WormsPreset,SmoothCircles,BarDamp,PondPt,BobblesPreset);
    preset=new presetList[i]();

  56. 2008-10-05, 15:39 by Todd

    Im trying to build a flash player that will play a stream from shoutcast. But Im trying to get a REAL spectrum analyzer built in it also. I keep hitting dead ends. anyone have any Ideas?

  57. 2008-10-16, 22:14 by TronXoay

    Nice code but it can not run with RMTP. Please check it again

  58. 2008-10-18, 20:36 by felgi chromowane

    Hello. Can i too add this on mysite? I think, this is very helpful. Greatings.

  59. 2008-10-19, 2:12 by Antti Author comment

    felgi chromowane: sure

  60. 2008-11-04, 23:39 by dbx166xl

    Really sick! The power that flash is gaining over bridging the gap between audio + visual cohabitation is quite exciting. I can’t wait to digest the source for this —- great work!

  61. 2008-11-06, 18:45 by Inder

    Hi Antti,

    Your Job is Awesome… I have downloaded and tested your files… But 1 question I have if you can please answer.

    When I set Volume to half in your source code I found that Spectrum’s become slower to response.. say when Volume was 20 % then I was used to very low animation.. But When I again raised volume to 100 % the bars again started animated with full thrust…

    is it Possible to animate the bars with full thrust even at slow Volume…. ??
    Like it is happening in Windows Media Player and Win Amp etc …

    Thanks in Advance
    Once again congrats for a great Job.

    Best Regards
    Inder

  62. 2008-11-09, 13:59 by Ronald

    I found you through this contest @ http://theflashblog.com/?p=197

    You should’ve won! Your visualizations are amazing!

  63. 2008-12-17, 21:05 by Dorsey Krofft

    this one is for DougStudio…

    i HAVE to know what song you’re using here: http://www.dougstudio.co.uk/spectrum_fft_on/

    i have the window open, and i’ve been just letting the song play over & over. this has been going on for about an hour and a half now… LOL!

    (awesome analyzer, by the way! really clean!)

    CHEERS!
    dorsey

  64. 2008-12-30, 13:19 by Sağlık ve Yaşam Portalı

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

  65. 2009-01-28, 18:27 by "Lida Dai Dai Hua Jiao Nang Seo Yarışması"

    is it Possible to animate the bars with full thrust even at slow Volume…. ??

  66. 2009-01-28, 18:28 by "Lida Dai Dai Hua Jiao Nang Seo Yarışması"

    “Lida Dai Dai Hua Jiao Nang Seo Yarışması”</a

    is it Possible to animate the bars with full thrust even at slow Volume…. ??

  67. 2009-01-28, 18:29 by "Lida Dai Dai Hua Jiao Nang Seo Yarışması"

    “Lida Dai Dai Hua Jiao Nang Seo Yarışması”

  68. 2009-01-28, 18:30 by "Lida Dai Dai Hua Jiao Nang Seo Yarışması"

    “Lida Dai Dai Hua Jiao Nang Seo Yarışması”

  69. 2009-03-19, 17:35 by Jan

    I am using the Revolt plugin for the JW player (which is brilliant by the way) and am trying to get it to show the waveform instead of the visualisations, but it doesn’t seem to be recognising the parameter. I guess I am doing something stupid – I have tried posting in the JW forum but am getting no response, just wanted to check that a) the plugin supports the “simple=true” parameter and b) get a view of what the waveform image is like so I can see if it’s what I need. Can you or anyone else here help??

    Ta

  70. 2009-04-23, 15:02 by Vishal

    awesome work…i like it

  71. 2009-05-01, 0:10 by Zee

    Its Great!

  72. 2009-07-01, 3:54 by Blog de Pirrin » Archivo del Blog » Analizador de Espectros en Actionscript 3

    [...] Les dejo el link donde pueden descargarlo, además de que a partir del código pueden crear un nuevo efecto (o drawers, como algunos le llaman). Revolt actionscript 3 [...]

  73. 2009-07-03, 16:58 by RJ

    Thanks for sharing this Antti… very cool stuff! Whewww….got alot of catching up with as3!

  74. 2009-08-04, 15:18 by Mick

    wow what a treat :D !!

  75. 2009-08-05, 19:24 by j dennis

    hi

    thanks for the amazing source to this plugin.

    i want to use just one of the presets in the plugin, so i need to change the source.

    i’ve downloaded the source from your site, but i still can’t get the Revolt.fla file to compile in Adobe Flash CS3 with Actionscript 3.0

    There are always Compiler Errors. It starts with:
    – 5001: The name of package ‘com.anttikupila.revolt.Revolt does not reflect the location of this file…..
    – 5001: The name of package ‘com.anttikupila.revolt.Presets does not reflect the location of this file…..
    etc…

    On the JW site there are also no other references to importing any .AS files before the line:

    import com.anttikupila.revolt.Revolt

    So please help, why doesn’t it compile, and what includes or correct syntax should be used ??

    Adobe Flash help is next to useless too.

    Thanks!

  76. 2009-08-05, 19:44 by Antti Author comment

    j dennis: it probably just can’t find the files. The package structure is com.anttikupila.revolt so the folder structure needs to be the same. If you’re compiling with flash the easiest way to make it work is to put the com folder in the same folder as the .fla. For more info: http://www.google.com/search?q=flash+“does+not+reflect+the+location+of”

  77. 2009-08-06, 17:21 by j dennis

    hi Antti

    thanks for the reply. all of the files are in the same folder.

    what exactly does import com.anntikupi.revolt point to ? … is it a website or a script ? … how does Flash know what to import if it hasn’t been defined ?

    very confused!

    maybe I have extracted the files from the zip incorrectly ?

  78. 2009-08-06, 17:31 by j dennis

    my fault. i had extracted the files incorrectly all into the same folder.

    i now get what the import statement is referring to: c:\myfolder\com\anntikupi\revolt\revolt.as

    compiling ok now. thankyou so much again. great work!!

  79. 2009-09-17, 23:12 by knehez

    One question: how to make the effects transparent? I mean, if I have a background image and I’d like to map the effects to the given image, not onto the black background, how it is possible to do it?

    BTW, Its a Great work!

  80. 2009-09-24, 19:02 by adam

    downloaded and unzipped, using cs4 and getting error?

    next effect is ‘smooth line without fourier transformation’
    Error #2044: Unhandled IOErrorEvent:. text=Error #2032: Stream Error.
    at com.anttikupila.revolt::Revolt()
    at Revolt_fla::MainTimeline/frame1()

  81. 2009-10-29, 19:15 by Olu

    @Adam (if you haven’t figured it out yet :) )- this is because there’s no mp3 file in the download and the script is looking for one. You’ll need to change the location and name of your mp3 in the fla file code.

  82. 2009-10-29, 20:14 by oshy

    If I want to add a stop and play button, how do I stop the music?
    Many thanks.

  83. 2009-11-05, 1:44 by floor44.co.uk - The Personal Website of Andrew Hosgood

    [...] looking even further, I found this. Another spectral anaylyser, but with more variations, including…A WAVEFORM! The developer, [...]

  84. 2009-11-16, 10:43 by Dave Bleeker

    If I understood it correctly this spectrum analyzer is free to use. I have created a skinnable mp3 player, which skin can be changed on-the-fly using js or flashvars. I just finished adding a “plugin” tag in the skin xml file, where this spectrum analyzer is used as example to show optional plugins can be added with by only refering to the swf file itself (no code).

    The mp3 player source files and documentation can be downloaded for those who are interested.

    Many times thanks for the awsome spectrum analyzer!

  85. 2009-11-16, 13:26 by Dave Bleeker

    the link would be useful to, this is:

    http://mp3.detailed-simplicity.com/

  86. 2009-11-26, 4:54 by esmin

    hi, I plan to use revolt in one of my games. Does link to this site in “credits” sections represents enough attribution, since attribution is not defined…

    …Attribution — You must attribute the work in the manner specified by the author or licensor… (CreativeCommons Attribution-ShareAlike 2.5 license)

  87. 2009-12-08, 19:39 by Florian

    Is it possible to run Revolt with let’s say a width of 100% and a height of 90% of the browser but displaying the visualizations from another instance of jw player that is in a div on top or at the bottom 10% of the page?

    With other words, revolt will not play MP3s, only displaying the audio visuals of the other instance of jw player.

    Is this possible? I really hope you can reply.

    Thank you very very much!
    Florian

  88. 2010-01-03, 8:36 by Joel Tong

    Hey Kupila,

    Your visualization is really nice! I am Joel Tong. Am currently working on an open source Flash sound spectrum visualizer engine in my free time called DingX. When released in Version 2, it should be able to support the smooth transitioning on 3D / 2D visualizers with minimal code for the end-user. It is based on AS3 and PV3D. Currently, it has 3 visualizations.

    As my project is similar to yours, could we combine / port your code to my engine? You can contact me via my email / blog.

    Thanks! Looking forward to your reply!

    Best Rgds,
    Joel Tong

  89. 2010-06-07, 17:23 by Ivan

    Would anyone be kind to make a version of Revolt that uses xml mp3 playlist? I mean, when start revolt.swf to automatically start music from xml playlist. Thanks in advance…

Post a comment