Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Tomags on Tue 28/12/2021 10:55:33

Title: [Solved] Sound effects ending abruptly
Post by: Tomags on Tue 28/12/2021 10:55:33
Hi all,

I'm having an issue with some particular sound effects that end abruptly in the middle of being reproduced.
I have a screen where a character will give you a random greeting sound. Most of the sound effectes play correctly, but two of them are cut abruplty: they start playing but it gets cut in the middle of the sentence. For example it is meant to say "Morning" and says just "Morn".

I actually was able to fix one of them by editing the sound in Audacity and removing a bit of "blank space", and AGS seemed to like it. But tried the same with "Morning" and still cutting it. It plays completely ok on preview from within the AGS engine.

I'm not playing any additional sound immediately (apart from the music on the background) as far as I can tell.

Maybe some corruption on the file that the game cannot handle?

Any tip appreciated.

Thanks
Tomas
Title: Re: Sound effects ending abruptly
Post by: Cassiebsg on Tue 28/12/2021 16:02:20
What format are the sound files?

If they're WAV, try to convert them to OGG (Audacity can do it).
Title: Re: Sound effects ending abruptly
Post by: Tomags on Tue 28/12/2021 16:11:28
Hi guys,

I think this is somehow fixed now (not sure how).
I added code to play the sound from a different event (just when pressing the "C" key), to have the sound played in a different context just to see if it made any difference.
But I get the impression that is now fine on both events. Maybe restarting the computer did its magic, or I wasn't looking at it correctly.

@cassiebsg, thanks a lot for the suggestion, sounds like a good tip. Actually, I was using mp3 for the sound effects (no OGG nor WAV) as well as the music. Do you think this is a bad practice?

Thanks!
Tomags

Title: Re: Sound effects ending abruptly
Post by: Cassiebsg on Tue 28/12/2021 16:37:32
Wav is uncompressed, and in the past there has been a small bug in it (not sure it has been fixed).

AGS can play OGG, so there is no need for the computer in which the game runs to have any codex installed.

MP3 used to be copyrighted, it no longer is, but you still need an exterior codex installed to play it, as far as I remember.

So, yeah, I would recommend Theora OGG for both audio and video.  ;)
Title: Re: Sound effects ending abruptly
Post by: Crimson Wizard on Tue 28/12/2021 17:20:35
Quote from: Cassiebsg on Tue 28/12/2021 16:37:32
MP3 used to be copyrighted, it no longer is, but you still need an exterior codex installed to play it, as far as I remember.

That's MPG/AVI videos, MP3 sounds do not require external codecs.

There was a problem of some MP3 or OGG sounds not playing an ending bit, which was never fixed, but I recall the solution was to add a tiny empty gap in the end (not sure).
Title: Re: Sound effects ending abruptly
Post by: FanOfHumor on Wed 29/12/2021 06:23:01
At what version of AGS did mp3 stop being copyrighted.
Title: Re: Sound effects ending abruptly
Post by: Snarky on Wed 29/12/2021 07:06:24
It's not about the AGS version, and it's not about copyright. MP3 relies on technologies that were patented. Those patents expired at various times between 2007 and 2017 at the latest. (Outside of the US, it had all expired by 2012.)
Title: Re: Sound effects ending abruptly
Post by: Tomags on Wed 29/12/2021 09:33:14
Thanks for that guys, that is great info regarding the music codecs, etc.
I think I'll keep it in mp3s for the time being as the project is almost finished (I chose it mostly because of compression), but may consider OGG for future probjects.
The issue seems to be resolved now, hopefully for good, but will pay attention just in case it appears again.
@Crimson, thanks, I think that's exactly what was happenning to me. And the workaround makes sense. In my case I more likely resolved it by editing and removing a bit of the sound, but not sure. Also, to note that these sound strange behaviour only appeared after I edited the sound effects in audacity, amplifying them because they were too low. Maybe the amplifying process added some sort of "impurity" to them that AGS didn't like.

Thanks again.
Tomags
Title: Re: [Solved] Sound effects ending abruptly
Post by: Cassiebsg on Wed 29/12/2021 12:10:16
When amplifying the sound, you need to keep in mind that there is a limit, beyond that limit it will start chopping the sound. You can see it in the sound wave, that the top spikes gets chopped.