Why is that that sounds sometimes play, sometimes don’t, and sometimes cut out early?
This script is attached to an always actuator with a logic delay of 50
import GameLogic
import random
cont=GameLogic.getCurrentController()
owner=cont.getOwner()
rand_step=owner.last #The last footstep
while rand_step==owner.last:
rand_step="gravel" + str(random.randrange(1,5))
owner.last=rand_step #Store this new footstep as the last one
print rand_step #for debugging
footsound=cont.getActuator(rand_step)
GameLogic.addActiveActuator(footsound, 1)
I have 4 actuators each with their own unique footstep wave sound.
My debug screen prints up:
gravel1
gravel4
gravel1
gravel3
gravel2
gravel1
gravel2
gravel4
… and so on.
Just as it should. But it only plays the files every now and then. Its also setup so that it wont play the same footstep in a row twice which, along with the delay, should give the sound enough time to complete itself and start over.
I tried using pygame for sounds but you cant get them to work with the 3d sound.
Ive had trouble with sound in blender for a long time and am wondering what i am doing wrong, or if its Blender.
Can’t help you with the python code (I understantd you play a random sound, but that’s all )
As everybody know, there still trouble with wav sounds in blender.
Did you try to attach each sound to a keyboard sensor (ex: press 1 to play gravel1, 2 for gravel2…) ?
You could use your keyboard like a kind of “organ” and test if the sounds are playing fine or not playing at all.
This way you could know if the trouble comes from your code or blender.
Pretty much the only format you can use is a .wav, but I heard you can get .mp3 and .ogg (or something) support from Python (those two just being compressed .wavs, apparently).
Hello, I have, (I think) the same kind of problem.
Sounds tend to chop, or miss half of music tracks etc. Strangely, the problems seem to occur more frequently when a sound is played over the preceding playback of the same sound resource. When the sound chopping problem arises, other sound playbacks other than the overlapped one seem to be affected and chopped likewise.
I have another question: How can I delete sound files once loaded into blend files?
Thank you for your help in advance.
UPDATE: Sounds seem to be chopped more often when sounds are played simultaneously. I cannot pinpoint why. Maybe, my method of playing sound is problematic?
:-? Yeah I’ve have the same problem too. When sounds are played too closely together, one if not all of the sounds get cut off. I really wish there was a workaround, but since you need 3d sound… not sure if there’s an easy workaround short of you coding in the 3d sound system yourself. It’s a bug I would say (but then again I’ve only gotten around to using sounds for like 2 small games, not officially released).