Strange bug with snd_sfx_play

If you have any questions on programming, this is the place to ask them, whether you're a newbie or an experienced programmer. Discussion on programming in general is also welcome. We will help you with programming homework, but we will not do your work for you! Any porting requests must be made in Developmental Ideas.
Post Reply
DoomSlayer
DCEmu Newbie
DCEmu Newbie
Posts: 9
https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
Joined: Mon Apr 01, 2019 12:09 pm
Has thanked: 5 times
Been thanked: 1 time

Strange bug with snd_sfx_play

Post by DoomSlayer »

Hello everyone,

I have a small problem with sfx

This is how I play sfx:

Code: Select all

sfxhnd_t boom = snd_sfx_load("/rom/boom.wav");
snd_sfx_play(boom, 255, 128);
The sound is played but it is very saturated / buggy

At the same time I use the ogg library to play the music, maybe we can not use the lib ogg and the sfx together?

I specify that I use wav 16 bit sounds for sfx

Thank you in advance for your answers :)

Solved : It looks like value 255 is not accepted, so I changed the snd_sfx_play call like this:

Code: Select all

snd_sfx_play(boom, 254, 128);
and it works well
gauauu
DCEmu Newbie
DCEmu Newbie
Posts: 8
Joined: Thu May 09, 2019 4:45 pm
Has thanked: 0
Been thanked: 0

Re: Strange bug with snd_sfx_play

Post by gauauu »

Thanks for posting this -- I ran into this today, and was getting pretty frustrated until I found your post.

Is this a bug in sfxmgr? The docs clearly say that you can go to volume 255, but it breaks the audio for me if I use 255 (where volume of 254 is fine)
User avatar
lerabot
Insane DCEmu
Insane DCEmu
Posts: 134
Joined: Sun Nov 01, 2015 8:25 pm
Has thanked: 2 times
Been thanked: 19 times

Re: Strange bug with snd_sfx_play

Post by lerabot »

+1 on this. Had this issue a year ago but forgot to comment on it.
gauauu
DCEmu Newbie
DCEmu Newbie
Posts: 8
Joined: Thu May 09, 2019 4:45 pm
Has thanked: 0
Been thanked: 0

Re: Strange bug with snd_sfx_play

Post by gauauu »

I've opened an issue on the kos github project. Please chime in if you think I missed anything important.
User avatar
Quzar
Dream Coder
Dream Coder
Posts: 7497
Joined: Wed Jul 31, 2002 12:14 am
Location: Miami, FL
Has thanked: 4 times
Been thanked: 9 times
Contact:

Re: Strange bug with snd_sfx_play

Post by Quzar »

Could people having the problem please provide the wavs that it's occurring with? After reviewing the code (I made the most recent changes and was worried I broke something) I don't see any silliness like overflows that would cause this. From looking through forum archives though, I do see a lot of people complaining that the default volume table is way out of whack. It works logarithmically, and the practical effect is that most sfx are only audible from volume 240 up.

My instinct is that the audio issues being experienced are simply due to the extreme volume. The kind of effect you might get in any system when turning the volume to the maximum possible. With samples I could listen and report back.

I think a long-term way to address this issue may be to recalculate the volume table used by the aica program for sfx.
"When you post fewer lines of text than your signature, consider not posting at all." - A Wise Man
gauauu
DCEmu Newbie
DCEmu Newbie
Posts: 8
Joined: Thu May 09, 2019 4:45 pm
Has thanked: 0
Been thanked: 0

Re: Strange bug with snd_sfx_play

Post by gauauu »

Here's the wav I was using

I have no idea if your guess at the problem is correct or not, but I found that playing the wav at volume 255 not only made it sound bad, but also completely broke the ogg stream that was playing at the same time (caused it to start stuttering and skipping, even after the sfx sample should have been finished playing). So it seems that something strange is going on other than just overly-loud volume.

Are you the same person that would be looking at the issue I put on github? Should I post this there as well?

Thanks for looking at it!
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5652
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Re: Strange bug with snd_sfx_play

Post by BlueCrab »

Well, considering the GitHub you posted the report on is my private copy of the repository (which hasn't actually been updated in a while), no quzar wouldn't have any access to it there. I'm not exactly sure how people manage to find their way there and not to the "official" GitHub mirror of KOS at https://github.com/KallistiOS/KallistiOS ... But, I digress.

It's probably best to keep the discussion of the issue confined to one place, so why not just keep it here since this is where most of it is anyway. Duplicating it elsewhere doesn't really help matters anyway.
gauauu
DCEmu Newbie
DCEmu Newbie
Posts: 8
Joined: Thu May 09, 2019 4:45 pm
Has thanked: 0
Been thanked: 0

Re: Strange bug with snd_sfx_play

Post by gauauu »

BlueCrab wrote: Mon May 20, 2019 1:47 am Well, considering the GitHub you posted the report on is my private copy of the repository (which hasn't actually been updated in a while), no quzar wouldn't have any access to it there. I'm not exactly sure how people manage to find their way there and not to the "official" GitHub mirror of KOS at https://github.com/KallistiOS/KallistiOS ... But, I digress.
Huh, whenever I searched, all I found was yours. And as it didn't have any sort of indicator that it was a fork/copy, I assumed it was the official repo. Ah well, sorry about that.
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5652
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Re: Strange bug with snd_sfx_play

Post by BlueCrab »

gauauu wrote: Mon May 20, 2019 12:35 pm
BlueCrab wrote: Mon May 20, 2019 1:47 am Well, considering the GitHub you posted the report on is my private copy of the repository (which hasn't actually been updated in a while), no quzar wouldn't have any access to it there. I'm not exactly sure how people manage to find their way there and not to the "official" GitHub mirror of KOS at https://github.com/KallistiOS/KallistiOS ... But, I digress.
Huh, whenever I searched, all I found was yours. And as it didn't have any sort of indicator that it was a fork/copy, I assumed it was the official repo. Ah well, sorry about that.
You're not the only person to find your way there... That said, the README does point to the link I gave as the official GitHub mirror (which is still just a mirror -- the real official repository is on SourceForge still).
|darc|
DCEmu Webmaster
DCEmu Webmaster
Posts: 16373
Joined: Wed Mar 14, 2001 6:00 pm
Location: New Orleans, LA
Has thanked: 103 times
Been thanked: 90 times
Contact:

Re: Strange bug with snd_sfx_play

Post by |darc| »

BlueCrab wrote: Mon May 20, 2019 1:47 am Well, considering the GitHub you posted the report on is my private copy of the repository (which hasn't actually been updated in a while), no quzar wouldn't have any access to it there. I'm not exactly sure how people manage to find their way there and not to the "official" GitHub mirror of KOS at https://github.com/KallistiOS/KallistiOS ... But, I digress.

It's probably best to keep the discussion of the issue confined to one place, so why not just keep it here since this is where most of it is anyway. Duplicating it elsewhere doesn't really help matters anyway.
Your repo is the only that appears when searching "kallistios" on DuckDuckGo, Google, or Bing.
Searching "kallistios github" makes the official one appear, but only after yours is listed above it. :?
BlueCrab wrote: Mon May 20, 2019 1:48 pmThat said, the README does point to the link I gave as the official GitHub mirror (which is still just a mirror -- the real official repository is on SourceForge still).
Deep, deep several pages in the docs/README file, yes. But not in the README.md file that is essentially the welcome screen for github projects. Perhaps you should add it there?
It's thinking...
Post Reply