Having issues playing sounds in succession or at the same time

Wish i could describe it better, but thats about it.

Iv noticed that GDevelop is struggling to play more than one sound at a time or in quick succession.

For example, i have a coin and a bomb next to each other, they both play a sound on pick up, both sounds are made with JFXR.

If i pick botch at the same time or close to it, only one sound will play and some times it will bug out and cut itself half way trough playing.

Iv noticed this before, but since my other project dosent have as many collectibles i just thought it was a random rare bug that happens when you pick up too many items at once.

and no, theres nothing funky with my events, iv tried it multiple ways and nothing.

I even tried putting the coin and the bom in different channels, but same result.

Idk, sound just bugs out sometimes in gdevelop and thats something iv noticed from the start.

Can you show your events?

Edit: For more detail, I have about a dozen different sounds for enemies at once without issue.

For some context:
If you’re using just the “play sound” or “play music” actions, they are all using the same sound buffer without much direct control.

LIkewise, the “play sound on a channel” (or music) can only have one sound within a channel running at the same time.

Audio channel conflicts (or audio buffer overlap) is a game dev thing as old as time, and if you have enough audio at once you have to start manually managing it.

Something I’ve done in the past when I had enough audio to run into issues: Generally what I do is designate a “range” of channels for a certain type of audio. 0 is always music, 1-10 is player sounds, 11-20 is enemy sounds, etc. Then I have have a number variable for “playerSoundCh” “enemySoundCh”, etc. In my audio events I will use the “Play sound on channel” condition, but set the channel to enemySoundCh, and increase the variable by 1. I have a always running event that resets them, as well (checks if enemySoundCh is = 21, then sets it back to 11)

Not saying you necessarily need to go to this extent, but I’ve not run into any issues with audio collision/buffer overlap since doing that.

Edit:
Here’s an example with the above setup:
Preview:
https://game-previews.gdevelop.io/1710106918501-867852/index.html
Events:

You can jam on 1 and 2 on the keyboard at the same time all day long and it’ll play fine. You can also set up your own function extension that automatically does the play sound on a variable channel + variable increment into the same function action, if you want.

3 Likes

Later when i have the time ill try to show you the issue im having and the events.

I get what your doing for your sounds, its basically what i do for my attacks and such, giving each a tag with a number that keeps adding untill it resets, its pretty cool :slight_smile:

Yeah… i kinda goofed on the channel bit, i put the bomb and coin sound on different channels to test if they would play properly, when they didnt i checked and no idea if i got distracted or what… i didnt realize i put them both on the same channel… no wonder they werent playing… sight… sorry my bad.

As for the just “Play a Sound” ones, i tested it and yeah its as you say, too many of those cause problems, i didnt know about the sound buffer thing.

Iv now put every sound on its own channel and made a list of channels in use.

Guess this still served for something, i did learn a bit more about sounds :slight_smile:
Just sorry about the bug report… nothing buggy about it, my brain just had a brainfart…

1 Like