For a long time, there has been nothing worth shouting about in terms of Flash’s capabilities with Sound.  Indeed, the furthest you got was some exciting pan and volume controls – admittedly functional but ultimately limited and uninspiring.  Enter Flash CS4 and Flash Player 10!

Flash CS4 brings with it an event for audio objects called SampleDataEvent (check out the Adobe Reference).  In essence, you create a sound object in Flash, like you would normally do.  But, instead of loading a MP3 file and playing it, you can add the SampleDataEvent listener and ‘feed’ the sound object with your own data, and play it!

This event goes hand in hand with the sound.extract() method.  This method will extra the raw sound data from a sound object, and feed the SampleDataEvent of another sound object.

Now, at the moment, this just sounds like the long and way to play a MP3 file, however it’s the bit in between extracting and ‘feeding’ the sound object that we’re interested in.  The raw data can be manipulated in any way you like.

The most basic thing you can do with a sound (probably) is to slow it down or speed it up.  This is done by taking the raw data and either missing out samples during playback (so that the sound is perceived as faster), or by adding more samples, by duplicating the raw data (so that the sound is perceived as slower).  At the same time, if a sound is sped up, the pitch is increased, and vice versa.  Easy eh?

I won’t go into further detail, but move to my little demo application that I’ve made.

http://glidepro.net/go-dj/

It’s a simple DJ application.  Two tracks are loaded, and played at once.  You can control the pitch of both to bring the tracks to a near-identical speed (in terms of rhythm).  There’s also a feature on the left track to pull/push it in sync with the rhythm of the right track.

Hope you had a bit of fun with this funny little app thing!

(credits go to Lee Brimelow author of The Flash Blog for his examples and Andre Michelle for his examples and his inspirational work with all things Flash and audio)


SPEAK / ADD YOUR COMMENT
Comments are moderated.

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Return to Top

Sound Manipulation in Flash

FRESH / LATEST POSTS

TAG / CLOUD

adobe Codeo Cogapp dynamic audio glidepro make some noise Michael Aldridge Music on the fly Papervision popforge project Swiing University wiiflashserver WiiPaint Wii Remote Windows 7