Sound problem

BlitzMax Forums/BlitzMax Programming/Sound problem

Tom(Posted 2005) [#1]
Anyone else get fluctuating sound? I think it's the pitch that's changing for me, though I've noticed when other sounds are playing it can also sometimes go tinny sounding too.

'Tap '2' a few times, the sound plays fine. Tap '1' a few times to play the same sound with a random
'rate, then tap '2' again, the pitch fluctuates (it shouldn't?)

Global s:TSound = LoadSound("yoursound.wav")
Graphics 800,600,0
Repeat
	If KeyHit(KEY_1)
		Local chan1:TChannel = PlaySound(s)
		SetChannelRate chan1,Rnd(.8,1.2)
	End If
	
	If KeyHit(KEY_2)
		Local chan2:TChannel = PlaySound(s)
	End If
	
	Flip
	Delay 5
Until KeyHit(KEY_ESCAPE)



tesuji(Posted 2005) [#2]
I get the same but I reckon it's because you're allocating a new channel everytime you do the PlaySound and because there's only a finite number of channels available you'll get some re-use eventually.

This works but note that it'll cut of the existing sound when a new sound is played (non polyphonic).
'Tap '2' a few times, the sound plays fine. Tap '1' a few times to play the same sound with a random
'rate, then tap '2' again, the pitch fluctuates (it shouldn't?)

Global laserfire1:TSound = LoadSound("yoursound.wav")
Global chan1:TChannel = AllocChannel()
Global chan2:TChannel = AllocChannel()

Graphics 800,600,0
Repeat
	If KeyHit(KEY_1)
		PlaySound(laserfire1,chan1)
		SetChannelRate chan1,Rnd(.1,1.9)
	End If
	
	If KeyHit(KEY_2)
		PlaySound(laserfire1,chan2)
	End If
	
	Flip
	Delay 5
Until KeyHit(KEY_ESCAPE)



Tom(Posted 2005) [#3]
It can't be just that, try this. Tap '1' 2 times, then tap '2' a few times, it's worse! :)

Global laserfire1:TSound = LoadSound("data\laserfire1.ogg")
Graphics 800,600,0
Repeat
	If KeyHit(KEY_1)
		Local chan1:TChannel = PlaySound(laserfire1)
		SetChannelRate chan1,Rnd(.8,1.2)
	End If
	
	If KeyHit(KEY_2)
		Local chan2:TChannel = PlaySound(laserfire1)
		SetChannelRate chan2,Rnd(1)
	End If
	
	Flip
	Delay 5
Until KeyHit(KEY_ESCAPE)



TartanTangerine (was Indiepath)(Posted 2005) [#4]
I think there are still issues with the sound module. My sound quality deteriorates over a period of time, it's like the buffer is becoming overloaded and the sounds begin to stutter.


Tom(Posted 2005) [#5]
Tim, yeh exactly what I'm getting! My sounds eventually start to sound like all the bass/treble is filtered out or something.

I'll throw it in bug reports.