|
Hi,
I would like the Voice device to process a bunch of wav. files found in the scene using Python.
Basically:
1- Play and record a wav. file onto the Voice device using the wav. length
2- Create a new take and play and record the next wav. file in the scene onto the Voice device
3- Repeat step 2 until all the wav. files in the scene has been processed
Right now what I’m getting is this:
1- Creates a new take for all the wav. file (using the wav. file name) in the scene
2- Voice seems to process the wav files but only the last take gets Voice animation curves (from the last wav. file)
Any clues on what is missing? or wrong? (sry for the lack of comments)
[/code]
from pyfbsdk import * import time
def GetVoiceDevice():
lScene = FBSystem().Scene
lVoiceDevice = None
for lDevice in lScene.Devices:
if lDevice.Name == 'Voice':
lDeviceVoice = lDevice
break
return lDeviceVoice
def ClearVoiceWav( lVoiceDevice ):
lVoiceDevice.Components.removeAll()
def SetVoiceWav( lVoiceDevice, lWav ):
ClearVoiceWav( lVoiceDevice )
lVoiceDevice.Components.append( lWav )
lDevice = GetVoiceDevice()
if lDevice:
ClearVoiceWav( lDevice )
lDevice.Online = True
lDevice.Live = True
lDevice.RecordMode = True
lSystem = FBSystem()
lScene = lSystem.Scene
lPlayerControl = FBPlayerControl()
for lWav in lScene.AudioClips:
lTake = lScene.Takes[0].CopyTake( lWav.Name )
lSystem.CurrentTake = lTake
SetVoiceWav( lDevice, lWav )
lDuration = lWav.Duration.GetFrame( True )
lPlayerControl.GotoStart()
lPlayerControl.Record( True )
lPlayerControl.Play()
print "Processing %s" % lWav.Name
while lSystem.LocalTime.GetFrame( True ) < lDuration:
time.sleep(0.05)
lPlayerControl.Stop()
[code]
Thanks for you help
Marc
|
|
|
|
This is a guess, but try to chuck some FBSystem().Scene.Evaluate() after and/or before take changes and/or before/after some other stuff.
FBSystem().Scene.Evaluate() takes a long time, so don’t be too generous—but some functions combinations seem to need an Evaluate between them to execute as expected.
|
|
|