Crossfade audio in Flex – FadingSound prototype
I’ve been fielding questions about fading audio in Flex lately and decided to package up my FadingSound. I worked on this about a year ago and then threw it on the shelf, so I’ve begun cleaning it up and wanted to release a prototype as a proof of concept. This class creates the Sound and SoundChannel objects for you and fades in and out each song in a playlist. It’s so simple, all you have to do is create an instance say:
where “playlist” is an ArrayCollection of URLs. If you just want to have 1 song fade in or out, only put 1 URL in the array. Optional params specify the length of fades and the duration of the songs (if you want to scan through 10 second clips for example). See it in action here.
Fading 1 song in was the easy part – the hurlde was to have 2 channels playing at the same time and control their fades to give the illusion of concurrecny. There are still some bugs in it with buffering songs and fading out at the right time with dynamic tracks which is why the example only plays short clips rather than full songs. I’m in the process of cleaning that up and will update things when I get time. Also I’m going to have an mp3 player that utilizes this where you can create XML playlists to feed it. Feel free to drop me line with features you’d like or any comments on the FadingSound.
Application demoing the Prototype
4 comments4 Comments so far
Leave a reply
It has a spectacular effect when you get the first part of “More Love” and then “Bones” slammed together.
Hi Sir,
I’m looking for a script that makes my sound fades in the end, I’ve seen the sample application you made and its great. Is it ok if I ask the FadingSound.as file? and what if i prefer to play the sound completely and without minimum playtime?
Thanks!
Regards!
@lorie
Thanks. I’m integrating it into another lib for release very soon. It’s going to be a great set of audio tools for actionscript for use in Flex or Flash. Check back in the next week or two for that!
HiEvery other blog I have read about Sound Clips, has been lacking in information. Your insight into Sound Clips is sooooo much better than anything else I have read. Thanks Michelle