• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

GMS 2.3+ Wrong sound effect playing


I made a few very minor changes to my game's code and now my audio files and/or the array I've assigned them to are acting up. Let me be clear: I never edited the code that plays the cues whatsoever. It was working perfectly until I simply added a few more sounds to the game.

Here's an example:

else if key_use && otherbox = 1 && subpointer = 0 // Saves
                {savedelay = 60
This plays the "save" sound. It reads from this array which is initialized at the start of the game.

global.soundeffect[19][0] = SEsave_vex
global.soundeffect[19][1] = SEsave_gb
//global.soundeffect[19][2] = SEsave_nes
This has always worked fine. Now, I try changing the sound effect code to:

else if key_use && otherbox = 1 && subpointer = 0 // Saves
                {savedelay = 60
Again, the code is in the same place, it's activate the same way, I just hardcode a "1" where the "0" used to be. So, SEsave_gb should play now!... right? Except it doesn't. The *OLD* sound effect still plays. I have checked the sound effect many multiple times. I SEsave_gb is very different from SEsave_vex, but SEsave_vex plays every time.

So you're probably thinking "okay maybe the code is doubled up somewhere else and it's the "double" that's playing, right? Well when I delete that line of code entirely, no sound effect plays. So I can confirm that this is absolutely the correct code, and that the contents of this array are never changed elsewhere in the code. So what the hell is causing the problem? And how do I fix it?

edit: It seems to be that, for some reason, with (audio_play_sound(x,y,z), only the first # of characters of x are read by the game to get the asset. So (audio_play_sound(SEsave_gb,500,false) gives the exact same sound as (audio_play_sound(SEsave_vex,500,false) because vex was put into the game first. So that's why all of my SEzyx_gb sounds are playing the exact same sound effects as my SEzyx_vex sounds.

And even more confusing than this, when I change the file name to be something completely different (and update accordingly in the code and the array), a COMPLETELY different sound effect plays. As in, it's not the sound effect referenced by name. It's a completely different sound effect. In other words, (audio_play_sound(SEsgb,500,false) plays a completely different sound effect than what plays when I test this same sound in the resource tree. What the hell is going on? I already did "Clean project" twice.

edit2: ...it sounds like i have to reimport every single sound in the game. ugh: https://www.reddit.com/r/gamemaker/comments/lrbk9s
edit3: i resolved the issue by deleting a SINGLE sound effect entirely from my game. i... i have no idea how or why this worked, but all of my sounds are suddenly working.
Last edited: