FORUMS: list search recent posts

Crossfading sound in flash

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Joao Morgado
Crossfading sound in flash
on May 19, 2009 at 2:21:31 pm

Hi there,

I have two sound files that I need to crossfade.
The idea is to have a button/action that fades out the sound that is playing and simultaneously fades in another sound.

This is for an awards ceremony. The music should play continuously (in loop) on background, while the nominees are announced. When the winner is announced I need to fade out that loop and launch a new one.

Any idea how can I do this in flash???

Any help would be appreciated,

Thank you in advanced


Return to posts index

Justin P. Junda
Re: Crossfading sound in flash
on May 19, 2009 at 2:43:15 pm

This should be easy are you embedding these sounds or loading at ruuntime? Also can these people see your button or are you the only one that can see them?

Justin P. Junda


Return to posts index

Joao Morgado
Re: Crossfading sound in flash
on May 19, 2009 at 2:56:27 pm

I'm embedding the sounds.
The button is for no one to see, I will associate it with a keyboard shortcut and place it out of the visible area of the stage.

If possible, the perfect was to start the crossfade automaticly when I launch the award winner. But for now I would be happy If I just can put the crossfade to work.

Thanks in advance


Return to posts index


Justin P. Junda
Re: Crossfading sound in flash
on May 19, 2009 at 6:38:30 pm

Ok if your embedding it should go something like so. Bring in your sound clips to the library then place each one on a different frame and expand the frames as necessary till you see the whole wave form for that sound. Next if you click inside of the frame in the properties you can edit the sound and create a ending fade for the first, and a beginning fade in for the second. Once you have done this over lay the two using separate layers. Then create a button that is a keyboard shortcut or whatever and just tell the button to gotoAndPlay("whatever you name the frame or the number of that specific frame either or"). So therefore when you hit the shortcut it will go to that point and play.

Hope that helps have anymore questions let me know.

Justin P. Junda


Return to posts index

Joao Morgado
Re: Crossfading sound in flash
on May 20, 2009 at 9:05:07 am

Hi there,

I already tried that, the problem is, the awards will not always be launched at the same exact time, thats why I have the first loop.

So If I use the gotoAndPlay action as you say, when I press the button we will notice the sound cutting of. Thats why I need it to crossfade, so that we wont notice when the second sound is launched.

Is there any way to put the sounds in two layers and then when I press a button it fades out one layer and fades in the other one.

Thanks in advance


Return to posts index

demetri tashie
Re: Crossfading sound in flash (AS3 solution)
on May 20, 2009 at 1:12:32 pm

Joao,

Using the SoundTransorm Class, you can do a lot of manipulating of your sounds.

i am not familiar if there is a way to actually tween the volume from, say 1 to 0 and vice-versa. please, someone let us know if that is possible !

but as a work-around here is some code that will get you on the right track: by clicking a button, it will lower the volume incrementally by (-.1). nine clicks will obviously get it down to 0.

depending on your coding ability, you can then maybe add a Timer to it to once the button is clicked, to repeat the function 9 times over Time ( maybe a third of a second, which would then take the full fade effect to 3 seconds). if you then duplicate the code, add another button to do in reverse a new sound, then the 2 sounds, now in different channels, should now do the cross fade effect you are looking for.

(of course, a big presentation, on stage etc shold probably NOT be running their sound system through a Flash presentation - you should have your music and cues set up through a traditional sound system. but since this IS a Flash forum, and this IS the task at hand, here is some code to get you started using the SoundTransform Class:

the button is called "fadeOUTbtn", and the function is called "fadesOUT"

var snd:Sound = new Sound();
snd.load(new URLRequest("yourMusic.mp3"));

var soundCHNL:SoundChannel = new SoundChannel();
soundCHNL = snd.play();

var soundTrans:SoundTransform = new SoundTransform();

fadeOUTbtn.addEventListener(MouseEvent.CLICK, fadesOUT );

function fadesOUT(evt:MouseEvent):void{
soundTrans.volume-= .1 ;
soundCHNL.soundTransform = soundTrans;
}


let us know how it goes, and if you need more help.



Return to posts index


Joao Morgado
Re: Crossfading sound in flash (AS3 solution)
on May 20, 2009 at 4:16:14 pm

Hi,

ok... so that should be an exelent idea but the thing is all the file is alreday built in AS2, so getting it into AS3 now doesnt looks like a great idea. Besides the fact that I'm not a pro in AS2, but I can do small and simple things, but AS3 I just look at it like I'm reading a book in chinese.... lol

Any other simple ideia how this could be done in AS2.

One last thing. I do agree that a big presentation on stage should NOT be done in Flash and I do agree that worst than the video presentation in Flash is the sound running directly from flash, however my boss, fuckin loves flash and wants me to do it that way :s
So... thats why I need to do it this way.

Any idea would come in handy ;)

Thanks in advance


Return to posts index

Joao Morgado
Re: Crossfading sound in flash (AS3 solution)
on May 20, 2009 at 4:17:03 pm

Hi,

ok... so that should be an exelent idea but the thing is all the file is alreday built in AS2, so getting it into AS3 now doesnt looks like a great idea. Besides the fact that I'm not a pro in AS2, but I can do small and simple things, but AS3 I just look at it like I'm reading a book in chinese.... lol

Any other simple ideia how this could be done in AS2.

One last thing. I do agree that a big presentation on stage should NOT be done in Flash and I do agree that worst than the video presentation in Flash is the sound running directly from flash, however my boss loves flash and wants me to do it that way :s
So... thats why I need to do it this way.

Any idea would come in handy ;)

Thanks in advance


Return to posts index

demetri tashie
Re: Crossfading sound in flash (AS3 solution)
on May 20, 2009 at 5:13:13 pm

hi joao,

i didn't realize that this needed to be in AS2. i don't think i can help you with that - maybe someone else can. AS2 handles sound VERY differently than AS3. AS3 is so much more advanced in breaking sound into cahnnels, being able to mix and manipulate separate and distinct sounds.
oh well, you do what you can....

and heck, if the boss wnats flash ... give him flash !!!

i am not sure if AS2 handles more than one Sound at a time.

either way, there could be some work-arounds to accomplish this, but i would think you would first have to do some creative editing of the sound clips in an audio program ( Peak , etc ). you could then have different audio sections: main, main fade, awards fade, awards, and manaipulate them through your buttons. it takes some musical editing/mixing knowledge to make it sound as seamless as possible.

good luck, let us know what you come up with. or Anyone else can tell you about AS2 ????


Return to posts index


Justin P. Junda
Re: Crossfading sound in flash (AS3 solution)
on May 20, 2009 at 7:58:04 pm

So none of these sounds are used as linear even though you said you were embedding them, right? Well if that is the case shoot me your #number on a private message to justinatjustindotcom Ill either a walk you thorugh it on the phone or you can shoot me the project files and I will help you out as long as it not some disastrous mess of a file.

Justin P. Junda


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]