WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 07-27-2007, 01:41 PM
JMOwens JMOwens is offline
Member
 
Join Date: Jun 2007
Location: Providence, RI
Posts: 34
Question 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!
Reply With Quote
  #2  
Old 07-27-2007, 02:00 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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 )
Reply With Quote
  #3  
Old 07-27-2007, 02:15 PM
JMOwens JMOwens is offline
Member
 
Join Date: Jun 2007
Location: Providence, RI
Posts: 34
Thanks farshizz! I'll give it a shot.
Reply With Quote
  #4  
Old 07-27-2007, 02:19 PM
JMOwens JMOwens is offline
Member
 
Join Date: Jun 2007
Location: Providence, RI
Posts: 34
Ah, much better. You rock!
Reply With Quote
  #5  
Old 09-29-2010, 10:42 PM
Xiroz Xiroz is offline
Member
 
Join Date: Sep 2010
Posts: 1
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.
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 09:02 PM.


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