WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Sound Looping Problem (https://forum.worldviz.com/showthread.php?t=1161)

JMOwens 07-27-2007 12:41 PM

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!

farshizzo 07-27-2007 01:00 PM

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 )


JMOwens 07-27-2007 01:15 PM

Thanks farshizz! I'll give it a shot.

JMOwens 07-27-2007 01:19 PM

Ah, much better. You rock!

Xiroz 09-29-2010 09:42 PM

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.


All times are GMT -7. The time now is 12:14 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC