Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Audio for HTML export

A topic by airmcmonky created Jan 22, 2017 Views: 294 Replies: 1
Viewing posts 1 to 2
Submitted

Hi. I uploaded a very simple game and decided to add some audio, but I'm having trouble getting html audio to work. I've only uploaded an html version for now.

I only have two pieces of audio. I have a looping sound that plays while the game is running, and an explosion sound at the end of a round. The behavior I'm getting in my export is that the looping sound will play the first time through, then nothing plays after that. Even disabling the looping sound, the explosion sound will not play. I understand that audio is tricky with web games, but I'm curious if anyone here has experience getting it working in godot exports. Any help would be appreciated.

Submitted

Well, after some more tinkering I got it working. I'll go ahead and say what seemed to make it work so that someone might get something out of this post.

First, I changed the import on my one shot sound to not import as the compressed format (set compressed to "disable"). Then, I changed the looping sound to play using the StreamPlayer instead of the SamplePlayer. The bonus of that is it made it easier to manipulate the sound as it plays.

One aside, I was able to figure this out by looking at the jam game Ball Basho(https://itch.io/jam/godotjam122016/rate/106873), which had working audio and had the code uploaded. Thanks.