Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by littlefoot

Hi guys,

I've been trying to figure this out on my own and asked via irc as well, but no luck so far.

Some of my sound effects are getting distorted in the browser. Listening to both the .ogg and .mp3 on my computer is fine, but when the sound is triggered in-game it sounds like there's a lightsaber in the background. I've tested in Chrome, Safari, and FF.

It doesn't happen to all sounds either. One is a footstep sound effect that plays when the player is moving on the x axis and the other is a swooping sound when something swoops down at the player, then back up at regular intervals.

Has anyone experienced this before/possibly knows what's causing it and how to fix it?

Thanks!

1 decade ago by Arantor

We haven't come very far in almost a year since Dom looked at HTML5 audio.

HTML5 audio, ultimately, isn't designed for sound effects. It's designed for background music and it really has to be abused structurally to achieve something workable for games, and while Impact does it well most of the time, it doesn't always manage it.

In your specific case, I'd wonder if you have sounds declared as multi channel or not and whether there's any situation where a sound can be triggered multiple times, once each frame causing the initial sound to stutter.

1 decade ago by littlefoot

Hmm, with the footstep sound definitely. With the swooping sound...maybe. I do notice it kind of doubling in on itself in the beginning and stuttering. Is there any way to force a sound to finish playing before the next instance starts, or better yet force it to not loop at all? I don't have it declared as multi channel as far as I know (I'm not even sure that is exactly, so it's definitely not something I did manually).

1 decade ago by Arantor

No, there isn't a way to force it to work like that, unless you manually deal with it yourself by tracking when it starts (with an ig.Timer) and refusing to play it until that timer runs out.

As far as multi-channel goes, normally when a sound is told to play, it will cut off any preceding instance of that sound (by essentially restarting it as opposed to playing another), but you can declare a sound as multi-channel when declaring it initially with the ig.Sound call - passing a second parameter of true indicates that multi-channel should be used so that multiple instances of the sound can be made to play concurrently.

For example, Biolab Disaster has the multi-channel for the blaster sound set at 4 channels, and you can mash the button 4 times and sound won't stutter, but if you happen to mash 5 times fast enough, it will stutter where it overrides the first one.

1 decade ago by littlefoot

Hmm ok, thanks. I think I need multi-channel set to false for this swooping sound. I will try to somehow track it and stop it from triggering repeatedly, maybe this will help the distortion issue.

1 decade ago by Arantor

False is the default if I remember rightly at least.

1 decade ago by littlefoot

I've just tested replacing the swooping sound with another sound effect using the same condition and while the sound does play repeatedly, there's none of that audio distortion audible. Could the length of the track have something to do with it? The swooping audio is a few seconds longer than the test one I used. Then again the footsteps audio, which was always doing the same thing was about the same length..

1 decade ago by Arantor

Oh, anything's possible. HTML5 audio is a mess.
Page 1 of 1
« first « previous next › last »