Author Topic: The "static" sound problem  (Read 2263 times)

0 Members and 1 Guest are viewing this topic.

Offline dizzy

  • 26
    • http://dizzy.roedu.net
The "static" sound problem
Hi there

Just wanted to start a separate thread on this topic because hopefully we will have many messages on this one.

I want to help track this problem down.

So, the "static sound" problem under linux I thought initially it was that when for example you used the afterburner each second it had a small  noise or when someone was talking the same thing.

But I think I got it all wrong. Last night I started to play RaiderWars 2.1 and I think I got biten by the problem. For example in the compaign briefings and the mission briefings that I can hear a little clear sound then a VERY STRONG NOISE (hard to support it with headphones) then again a little clear sound then again very strong noise and so on. Is this the "static" problem you were talking of ?

Can you give me any hints what should I try to track it down ?

Notice that the problem didnt showed up in the briefings of the "demo" campaign, they just show up in Raider Wars...

 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
The "static" sound problem
I've got the same problem, it makes the briefings essentially unbearable to listen to.
-C

 

Offline Col. Fishguts

  • voodoo doll
  • 211
The "static" sound problem
I noticed that bug too, but only sometimes. I can run the same build 2 times, and once the problem is there and next time it's not.

EDIT: Actually, I'm speaking of Windows builds, so it may not be Linux specific.
« Last Edit: August 26, 2005, 04:50:10 am by 1445 »
"I don't think that people accept the fact that life doesn't make sense. I think it makes people terribly uncomfortable. It seems like religion and myth were invented against that, trying to make sense out of it." - D. Lynch

Visit The Babylon Project, now also with HTL flavour  ¦ GTB Rhea

 

Offline dizzy

  • 26
    • http://dizzy.roedu.net
The "static" sound problem
Oh, being not totally Linux specific makes it very interesting I guess :) Also notice that the same problem happened with the Trascendant campaign when the Trascendent talked to you. Back then I thought the noise was part of the talk because it was suposed to sound funky and like a vision. But now after playing RW 2.1 I realised it was actually this bug, heh. Taylor was saying something about 16 bit mono sound that triggers this.

What is the difference of sound format between RW 2.1 and EMW 2.0 campaigns (I'm asking mainly Col. Fishguts as I see he is with the TBP team) ? I have never had any issue with EMW only with RW so and Trascendant so far.

 

Offline taylor

  • Super SCP/Linux Guru
  • Moderator
  • 212
    • http://www.icculus.org/~taylor
The "static" sound problem
The static thing only happens with WAVE files that are 16-bit, mono, 11025 Hz.  Converting that same file to 8-bit works, or to 22050 Hz works, or to stereo works.  It's also only in the streaming code since that same file loaded through ds.cpp plays fine.  The only thing that I can figure is that it's some type of buffer size issue.  Actually I know it's a buffer size issue, just not sure why.

When the buffer is computed I divide it by MAX_STREAM_BUFFERS since it will use that many buffers in rotation.  This is a memory saving tactic since each stream could be using quite a few megs of ram otherwise.  In this one case though, not doing it will make the audio play fine.  After looking at that for a little bit last night I figured out that the static will happen when the buffer size equals the samples per sec of the WAVE file, in this case 11025.  Simple increasing the value resulting from the divide by 1 fixes the static.  I'm not totally sure why since being 1 less than the samples per sec works fine too.  This is one that I probably don't want to know the answer to though.

Anyway, it is fixed now and will be going in CVS after I've had a little more time to wake up and get something to eat.  This particular problem was specific to the OpenAL code and not a platform thing so Windows OAL builds would experience it as well.

 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
The "static" sound problem
Wow, that was a fast bugfix. :yes:

I think I may have CVS'd it too. *goes to check*
-C

 

Offline dizzy

  • 26
    • http://dizzy.roedu.net
The "static" sound problem
Taylor, thanks for looking into this. But by the same rationale it whould mean it can be triggered in other cases too if somehow the buffer size matches something with the other formats too. Now I dont know enough information to make a specific guess but possible guesses are:
- buffer size matches 22050 for 22050 samples/mono ?
- buffer size matches 22050 for 11025 samples/stereo or 41050 for 22050 samples/stereo ?

 

Offline taylor

  • Super SCP/Linux Guru
  • Moderator
  • 212
    • http://www.icculus.org/~taylor
The "static" sound problem
I never did test all of the instances, only one, but I'm pretty sure that that one 22050 case didn't have the static.  Either way though the code check assumes that any time the buffer size equals the samples/sec there will be static and changes the buffer size accordingly.  Even if it is this one set of particular values which causes the problem I don't want it ever showing up again with a different format.

 

Offline dizzy

  • 26
    • http://dizzy.roedu.net
The "static" sound problem
Just updated CVS. Your fix looks (or better I should say "sounds") fine so far. Thank you again :)