#1
|
|||
|
|||
Sound Looping Problem
Hi VizardWizards,
I'm trying to get a constant background (white-noise) sound for my environment, which I hoped could be achieved by looping a 5-second .wav clip. However, there is a slight pause and pop whenever it re-starts which is very disconcerting. I've tried looping the sound in Audition and it works fine there, so the pause is not inherent to the sound file itself. Does anybody have any ideas how to make a seamless transition when looping? Technical details: My VE is set up using a timer running at 60Hz since there are a lot of scripted events. I've tried several iterations of the sound code, including a version (inside the timer definition) that only initiates the loop once: if whiteNoiseInit == 0: soundWhiteNoise.play() soundWhiteNoise.loop(viz.ON) whiteNoiseInit = 1 I've also tried a version that simply tells it to play, since it's iterating anyway. And I've tried a version that initiates the sound loop outside the main timer function. All have this weird popping. Ideas? Thanks! |
#2
|
|||
|
|||
Hi,
Vizard uses DirectX for playing audio, and unfortunately it isn't good at seamlessly looping sounds. The Python winsound module seems to handle it a little better. Here is some sample code for looping a sound using this module: Code:
import winsound winsound.PlaySound('sound.wav',winsound.SND_ASYNC | winsound.SND_LOOP ) |
#3
|
|||
|
|||
Thanks farshizz! I'll give it a shot.
|
#4
|
|||
|
|||
Ah, much better. You rock!
|
#5
|
|||
|
|||
Farshizzo, is there a way to use the winsound commands and change the rate a sound is played? I'm trying to simulate a revving engine and the only method I've found to get the effect is using JMOwens original code, which causes me the same problems.
|
Thread Tools | |
Display Modes | Rate This Thread |
|
|