loading
 
Audio
Anonymous
11 year
Hi.

I have a problem with the audio. For example, when I include a format. Wav or beep in a state if .. and run the program, the audio is repeated all the time. I find the way that is heard only once.
I do not want the state to produce an infinite loop. When you enter the ring only been once, but keep the program running.

Thanks.
Steven Gentner from United States  [1446 posts] 11 year
You probably need to surround the audio playing with an if statement module and ensure that the latch checkbox is selected. This will then play the audio only once when the condition of the if statement changes.

Without this if statement the audio will play each time the pipeline is evaluated.

STeven.
Anonymous 11 year
Hi Steven.

This is my VBScript program to reproduce de audio file .wav. The problem is
when the program enters (if objecte = 1 then), the audio plays but to move to another if objecte = 0 the audio continues to play. The other audio chimes.wav not reproduce does not play until you finish the other.
I like it when it changes state directly change the audio.

objecte = GetVariable("MOUSE_X")

if objecte = 1 then

Set objVoice1 = CreateObject("SAPI.SpVoice")
Set objFile1 = CreateObject("SAPI.SpFileStream.1")
objFile1.Open "C:\Windows\Media\vientocentral.wav "
objVoice1.Speakstream objFile1

end if

if objecte = 0 then

Set objVoice2 = CreateObject("SAPI.SpVoice")
Set objFile2 = CreateObject("SAPI.SpFileStream.1")
objFile2.Open "C:\Windows\Media\chimes.wav"
objVoice2.Speakstream objFile2

end if
Steven Gentner from United States  [1446 posts] 11 year
I'm not sure you want to trigger off from MOUSE_X as that will change based on the position of the mouse. Is this correct?

The way audio works is that it will play to completion even if you try to change the audio file ... so you want to use very short busts of audio (preferably a single tone) that will end quickly without overlapping with the next tone. Thus I'd recommend using the Beep module more than the audio play module (or your VBScript alternative).

STeven.

This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index