WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Adding Audio to CAF Animation (https://forum.worldviz.com/showthread.php?t=3897)

WaterBottle 08-29-2011 10:28 AM

Adding Audio to CAF Animation
 
What i need to do is play audio and a animation at the same time. I would like to combined those in one .caf file. Using 3ds max how can i make the caf file have audio so if i play it in vizard? Thanks

Jeff 08-29-2011 10:42 AM

The Cal3D .caf file format is just for animations. In Vizard, you could play audio when the animation begins and stop the audio when it's done.

WaterBottle 08-29-2011 11:00 AM

I was thinking about doing that but every time i play an audio and a animation at the same time one waits for the other to be complete. I tried using
Code:

viz.playSound('filename')

self.VizBody.state(1)

I know there must be a better way to do this i am just new to vizard.

Thanks

Jeff 08-30-2011 06:54 PM

You could use a task function to play audio and stop if after the action is done:
Code:

import viz
import vizact
import viztask
viz.go()

avatar = viz.addAvatar('vcc_male.cfg',pos=[0,0,5],euler=[180,0,0])
avatar.state(1)
action = vizact.animation(3)

audio = viz.addAudio('jfk.wav',loop=1)

def animationTask():
       
        while True:
                yield viztask.waitKeyDown(' ')
                audio.play()
                yield viztask.runAction(avatar,action)
                audio.stop()       

viztask.schedule(animationTask())

If the sound is attached to the avatar you could use a sequence of actions:
Code:

import viz
import vizact
viz.go()

avatar = viz.addAvatar('vcc_male.cfg',pos=[0,0,5],euler=[180,0,0])
avatar.state(1)

startSound = vizact.method.playsound('jfk.wav',viz.LOOP)
action = vizact.animation(3)
stopSound = vizact.method.playsound('jfk.wav',viz.STOP)

actionSequence = vizact.sequence(startSound,action,stopSound)

vizact.onkeydown(' ',avatar.addAction,actionSequence)



All times are GMT -7. The time now is 03:35 AM.

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