I am making a Five Nights at Freddys Game. As some of you know, audio is a very crucial part of the gameplay. You are required to hear which side the Audio Cue comes from. If its like in the left hall, a Sound Affect will play exclusively in the left ear. When its in the right hall, something plays exclusively in the right ear. and if its in the middle of the map, it will play in both ears. Is there a way to make audio work like that in GDevelop?
There are no stereo fade actions that I know of, no. From some googling, the audio library used (howler.js) doesn’t support it at all.
There are spatial audio actions but they are for volume magnitude, not l/r stereo fading.
The only thing I can think of is you’d have to have separate audio files faded to the positions you want.
You could have two files (one faded all way to the left, one all the way right) and play them both, adjusting the volume of each as much as needed. That should allow you to have infinite permutations (including center which is just playing both at full volume)
Unless I’m misreading the documentation, these are just volume based, not left/right fade based.
The example project doesn’t work for me, though, so I cannot confirm.
i know, i read what you said. I just have absolutely no idea what to respond, because i have no idea why gdevelop hasnt changed audio libraries…and also because i know they likely never will. and so there isnt anything to say
Edit: Silver-Streak already gave this suggestion
do you think this could be done with an extension?
Not unless you’re outright injecting a different audio library entirely, no.
It looks like it’s not even a howler.js specific thing, but a general incompatibility with doing this in the WebAudio API. From some googling, the solution people are listing is basically what is listed above. Using 2 audio sources and mixing/crossfading the volume.
You might be able to do something via JS where you use howler.js to force split the stereo audio into completely separate audio streams and then re-join them (or remix them into separate audio channels entirely, I guess?), but that’s beyond me.
