Showing posts with label Audio. Show all posts
Showing posts with label Audio. Show all posts

Monday, 10 August 2009

SoundMixer.computeSpectrum + Timeline Audio

I am posting this little Flash ActionScript hint here in case somebody googles the same problem...

When a sound is embedded directly in the timeline of a Flash movie as opposed to being loaded dynamically, using the SoundMixer.computeSpectrum() method doesn't work. Well, sometimes it does and sometimes it doesn't. I had a working sound visualiser when I went to bed last night, and this morning I didn't. No changes to the code at all.
After a lot of googling I found this post by Jason Van Cleave on the [Flashcoders] mailing list. Thanks Jason!

Basically you have to load in an mp3 of silence, assign it to a channel and play it. Then your spectrum analyzer will work with your intended sound/music.

I know - its weird!

I also found loads of posts about how it is not a true spectrum analyser yadder, yadder which were quite interesting. If you like that kind of thing...

[CODE]
// Strange silent mp3 hack
var s:Sound = new Sound(new URLRequest("2sec.mp3"));
var channel:SoundChannel = new SoundChannel();
channel = s.play();

var ba:ByteArray = new ByteArray();
var g:Graphics = this.graphics;
addEventListener(Event.ENTER_FRAME, loop);

function loop(e:Event):void
{
SoundMixer.computeSpectrum(ba, true, 4);
g.clear();
g.lineStyle(3, 0xFFFFFF, 1);
g.beginFill(0xC11226);
g.moveTo(0, 250);

for(var i:uint=0; i<256; i++)
{
var num:Number = -ba.readFloat() * 500;
g.drawRect(i*2, 250, 2, num/15);
}

}


[CODE]

Sunday, 30 November 2008

The Spiralizer

The Spiralizer is a different version of The Blade - almost the same but more reactive to the music.

Saturday, 29 November 2008

The Blade


Yes its another visualizer but I think its got real retro power!

I call this one The Blade

Saturday, 22 November 2008

Cool Visualiser

I thought I should share this link to a cool visualiser with you since I've been doing a lot of these kind of things lately (but not in 3D). Its by Grant Skinner who is one of the Daddies when it comes to Flash and Actionscript.

Check it out- its pretty cool, and expect to see something similar here soon!

Which reminds me, I haven't shown you any papervision stuff....

Too much Candy?

Well I restarted Firefox and they all work again. I guess it must be a cache thing... too much candy and the fox gets sick!

Anyway here's another visualiser. This one looks like an eye so I've imaginatively called it Eye Candy!

Friday, 21 November 2008

More Candy!


I wrote a thousand words of my paper today so I though I'd reward myself by playing with Flash a bit more.
I came up with what I've called Candy Visualiser Its not interactive, you just admire its beauty!
Be warned! It is processor heavy so if you PC is old or slow it may crash! (sorry)

[Edit] I don't know whats going on with these Flash movies, sometimes they work and sometimes they dont....

I know all these generative art things have been done before but they are so much fun to do!

Thursday, 20 November 2008

Smoking Wave Eye Candy: Revisited

As promised here is the Smoking Eye Candy demo that you can play with. You may need to download the Flash 10 plugin (firefox) or ActiveX (IE) but the page should have a link to make it nice and easy for you :)





I like it so much I used a screenshot for this blog title.

Let me know what you think.

[Update] There still seems to be an issue with Firefox, although it worked when I posted this :s
Safari seems OK though, and JackMedia says it works for him in FF and Safari. I would appreciate it if you could tell me about any issues - browser name/version etc.

Friday, 14 November 2008

Smoking Wave Eye Candy















Continuing from my last post "Ultimate Kaoss?" this uses the computeSpectrum method of the SoundMixer class. For some reason it wont work in a browser. When I work out why I'll post a link here so you can have a play.