Sound problem

BlitzPlus Forums/BlitzPlus Programming/Sound problem

Dan60(Posted 2006) [#1]
Sometimes the sound gets distorted. I'm using wav files. Any ideas what might be causing that?


b32(Posted 2006) [#2]
If some sounds are distorted from the start, it might be the WAV format. I believe you can't load 32-bit wav files. If the sound starts distorting during playback, there might be something else wrong, maybe with the DirectX ? Try running DxDiag, it has a test for DirectSound.


Adam Novagen(Posted 2006) [#3]
Hey Dan60, if you like, you could post a snippet of your sound code & email me some of the .wav files you're using - I'll check it out!
(My email is gigamaster.adam@... )


Dan60(Posted 2006) [#4]
I don't think its the .wav files. Like I said 'sometimes' the sound is distorted. Maybe I'm doing too many sounds simultaneously.


;******************************************************************************
;* LOAD SOUNDS *
;*******************************************************************************
Global sndGun = LoadSound("gun.wav") ;from other game
Global sndHit = LoadSound("can2.wav")
Global sndCollide = LoadSound("collision.wav")
Global sndbhitwall = LoadSound("bhitwall.wav")
Global sndTankHitWall = LoadSound("wallcol_low.wav")
Global sndExpHuge = LoadSound("exphuge.wav")
Global sndMissilesReady = LoadSound("missilesReady.wav")
Global sndNewTarget = LoadSound("beep1.wav")

Global chnTankNoise
Global sndTankNoise = LoadSound ("tanknoise.wav")
LoopSound sndtanknoise
chntanknoise = PlaySound(sndtanknoise)
PauseChannel(chnTankNoise)

Global chndrill
Global snddrill = LoadSound ("drill.wav")
LoopSound snddrill
chndrill = PlaySound(snddrill)
PauseChannel(chndrill)

;a few snippets below
chn = PlaySound(sndGun)
ChannelVolume (chn,z)

PlaySound sndGun


Adam Novagen(Posted 2006) [#5]
Ah, the old "how many is too much" problem. You're not alone Dan60, I had a similar problem with my developmental game, Blox. During a level testing session, I had the rapid-fire powerup enabled, which allowed me to shoot about 20 or more lasers a second, with a laser sound for each shot. Needless to say, it sounded more like one continuous sound than individual shots. Moreover, if too many sounds played at once, the background music cut off! I included a little bit of code to restart the BGM if it stopped, so that was the end of that. Bottom line, it is definitely possible to have too many sounds playing at once. Looking at your code, it doesn't seem like you should have that problem, but it also depends on how long the sounds are, and how frequently they play. I'm no Blitz sound expert, so I can't help you much more, but you might want to contact Support, or if you can, Mark Sibly (Blitz's creator) to see if you can get any further help.

Good luck!


Dan60(Posted 2006) [#6]
Thanks for the response Adam.
I prevent having more then one gun shot per frame, but maybe 20 gunshots per second is too many. The wav files are short. What do you think?

I'll be posting a link to the game soon for some testing.


Adam Novagen(Posted 2006) [#7]
Sure, no prob.
Well, with those limitations in mind, I don't think you'll run into my "audio blackout" problem. Anyways, best o' luck!