Forum Topic: AS3.0: Adding sound has added lag??

(310 views • 11 replies)

This topic is 1 page long.

<< < > >>
None

OzzyMgaow

Reply To Post Reply & Quote

Posted at: 9/8/08 05:03 AM

OzzyMgaow NEUTRAL LEVEL 27

Sign-Up: 02/27/05

Posts: 56

Hi.

I've made a platform game in Flash using AS3.
Game was fine, no lag, everything worked great.

I imported some small .wav files for sound effects and added them using code like this:

var s5:S5_enemy = new S5_enemy();
var channel2:SoundChannel = s5.play();

Now when playing the game I get lag (mostly in the screen scrolling) when a sound effect plays (like jumping for example) that I didn't get before.

Does anyone know why this is, and if there is a way to fix it?

Thanks.


None

OzzyMgaow

Reply To Post Reply & Quote

Posted at: 9/9/08 06:22 AM

OzzyMgaow NEUTRAL LEVEL 27

Sign-Up: 02/27/05

Posts: 56

bump


None

deadlock32

Reply To Post Reply & Quote

Posted at: 9/9/08 05:27 PM

deadlock32 NEUTRAL LEVEL 18

Sign-Up: 04/28/01

Posts: 2,502

have you tested out of the IDE? some times the IDE uses more resources than stand alone or in html


None

PrettyMuchBryce

Reply To Post Reply & Quote

Posted at: 9/9/08 07:36 PM

PrettyMuchBryce LIGHT LEVEL 06

Sign-Up: 03/17/01

Posts: 1,341

At 9/9/08 05:27 PM, deadlock32 wrote: have you tested out of the IDE? some times the IDE uses more resources than stand alone or in html

Definitely try what deadlock suggested. If that doesn't work then double check the size of your wav files and check the sound export settings.


None

OzzyMgaow

Reply To Post Reply & Quote

Posted at: 9/10/08 05:21 AM

OzzyMgaow NEUTRAL LEVEL 27

Sign-Up: 02/27/05

Posts: 56

Yes I've tested outside of flash with just the .swf playing, doesn't make a difference.


None

OzzyMgaow

Reply To Post Reply & Quote

Posted at: 9/10/08 05:24 AM

OzzyMgaow NEUTRAL LEVEL 27

Sign-Up: 02/27/05

Posts: 56

I've gone to export settings on the individual sounds and they are just set to default.

What would you recommend I change them to?


None

OzzyMgaow

Reply To Post Reply & Quote

Posted at: 9/10/08 04:20 PM

OzzyMgaow NEUTRAL LEVEL 27

Sign-Up: 02/27/05

Posts: 56

On xport I changed sound quality from 16 to 8, which reduced how it sounded significantly.

It also didn't remove the lag.

Getting frustrated. There's really not a whole lot going on, so it seems odd that just adding a couple sounds is screwing it up. argh!


None

OzzyMgaow

Reply To Post Reply & Quote

Posted at: 9/11/08 06:17 AM

OzzyMgaow NEUTRAL LEVEL 27

Sign-Up: 02/27/05

Posts: 56

bump :(


None

snuffyindustries

Reply To Post Reply & Quote

Posted at: 9/11/08 08:12 AM

snuffyindustries FAB LEVEL 13

Sign-Up: 03/22/07

Posts: 21

I imported some small .wav files for sound effects and added them using code like this:

Convert them to .MP3 then import them.

BBS Signature

Crying

OzzyMgaow

Reply To Post Reply & Quote

Posted at: 9/12/08 06:45 AM

OzzyMgaow NEUTRAL LEVEL 27

Sign-Up: 02/27/05

Posts: 56

Tried.

No difference....


None

greenkube

Reply To Post Reply & Quote

Posted at: 9/12/08 01:54 PM

greenkube NEUTRAL LEVEL 12

Sign-Up: 10/24/05

Posts: 560

How many times are you declaring the sound channel and playing the sound?

BBS Signature

None

OzzyMgaow

Reply To Post Reply & Quote

Posted at: 9/12/08 03:25 PM

OzzyMgaow NEUTRAL LEVEL 27

Sign-Up: 02/27/05

Posts: 56

The channel line is within the separate game functions, so I guess it's called everytime that functions is used. (so on every jump, or every pickup).

The top lines creating the sound instance is only used once on the program start-up.

Is there a better way to do that?


All times are Eastern Standard Time (GMT -5) | Current Time: 03:18 PM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!