Sounds not playing in game

Started by TGames, Sun 31/05/2020 02:36:37

Previous topic - Next topic

TGames

I am having an issue with adding sound effects to my game. I have audio files in the sound effects folder that play in the little audio preview but when I call the audio to play in-game nothing happens. This happens with several of my files, yet some play just fine. There is music in the background, but I have it at a lower audio priority and a lower volume. Is there something wrong with the files themselves?

Cassiebsg

#1
Are they WAV, MP3 or OGG

If the files are very short WAV files they may not be played. Try and convert them to OGG and see if it fixes the problem.

AS for Audio priority: AGS has 8 channels. One is reserved by default to Speech, even if you don't have speech.
That leaves 7 channels. Normally has music 1 channel (meaning that you can only have one music type playing at the same type). Rest is normally assigned to sounds/ambience as channels. If you haven't changed the normal default settings, means that you should be able to play up to 6 sound/ambience files at the same time, if you start a 7th then it'll check if it's higher priority of one that is already playing, and if so it'll turn the lower one off and play the new other. Otherwise it won't play the 7th if it's lower priority.

Having low priority in music and high priority on sounds won't stop music to play sounds.
There are those who believe that life here began out there...

Laura Hunt

Quote from: Cassiebsg on Sun 31/05/2020 12:08:57
If the files are very short WAV files they may not be played. Try and convert them to OGG and see if it fixes the problem.

Just for the record, I have the opposite problem: my characters' footsteps, which are some of the shortest sounds I have in my game, will not play at all if I upload them as .ogg, but they will play if they are .wav files. Go figure.

Apart from what Cassiebsg said, I've also found that using:

Code: ags
aSound.Play();


...never works for me. Ever. Sounds simply don't play, and I've never understood why. But if I do:

Code: ags
Audiochannel *whatever = aSound.Play();


...then I never have any issues.

Again, go figure *shrugs*

Crimson Wizard

#3
Quote from: Laura Hunt on Sun 31/05/2020 16:07:42I've also found that using:

Code: ags
aSound.Play();


...never works for me. Ever. Sounds simply don't play, and I've never understood why. But if I do:

Code: ags
Audiochannel *whatever = aSound.Play();


...then I never have any issues.

But this makes zero sense. It's literally same command, only in second case you are storing result of that command in a temp variable.

Are you doing anything to the stored channel after this?

PS. Ah, I realized this is a wrong thread to discuss this. But from description this problem sounds like there's either a mistake in script, or bizzare error in the engine (frankly I'd suspect former).

TGames

Converting the files to OGG seems to be working, thanks for the responses!

SMF spam blocked by CleanTalk