WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 03-20-2009, 01:40 PM
Uttama_vizard Uttama_vizard is offline
Member
 
Join Date: Sep 2007
Posts: 60
Avatar speaking problem

Hello,

My application requires interacting with an avatar (speaking) while wearing an eye tracking. What I want is that if my gaze goes towards the avatar, then the character should speak, but, when my gaze goes away from the avatar, the avatar should stop speaking or say something else.

But, the problem I am facing is that I am not being able to interrupt the avatar's previous action (before its scheduled completion).

I am using:
sound = vizact.speak("words.wav", scale= 0.007, sync=True)
character1.addAction(sound, pool=pool_number); pool_number = pool_number+1;

Then when I am using character1.clearActions(), it seems to me that I am not being able to interrupt the avatar's speech before its sceduled end point.

Any suggestion would be really appreciated.

Thanks

Uttama
Reply With Quote
  #2  
Old 03-20-2009, 08:04 PM
Gladsomebeast Gladsomebeast is offline
Member
 
Join Date: Mar 2005
Location: Isla Vizta, CA
Posts: 397
What you gotta do is write your own speak action.

Actions are defined in Python code, the vizact module actualy. There is an user defined action example in the Vizard help. Check that doc out, then open up vizact.py and examine the speak action. Copy the speak code into your own action module and modify it to stop the sound when the end action function is called.
__________________
Paul Elliott
WorldViz LLC
Reply With Quote
  #3  
Old 03-21-2009, 03:50 PM
Uttama_vizard Uttama_vizard is offline
Member
 
Join Date: Sep 2007
Posts: 60
Avatar Speaking Problem

Hello,

As per your reply, I was actually trying to update the speak function in this way:

def speak(filename, scale=1.0, morph='mouth_open', threshold = 0, sync = False):
import vizwave

#Get wave data
fname = viz.res.getFullPath(filename) or filename
avnumbers,length = vizwave.getsamples(fname,400,5)

if len(avnumbers) > 0 and threshold < 0:
# calculate default threshold, otherwise provided threshold is used
sum = 0
for value in avnumbers:
sum = sum + value
threshold = sum / len(avnumbers) # average value of the array

bla = viz.ActionData()
bla.data = [avnumbers,length,morph,fname,scale,threshold,sync]
bla.actionclass = VizSpeakAction
return bla

def end(self,object):
if not self.finished():
if self.audio:
self.audio.stop()
self.audio.remove()
if self.bone:
self.bone.unlock()
elif self.morphObj:
self.morphObj.morph(self.morph,0)
viz.ActionClass.end(self,object)

def pause(self,state):
viz.ActionClass.pause(self,state)
if self.audio:
if state:
self.audio.pause()
else:
self.audio.play()

But, it is not working properly. Actually, I feel I am not updating the speak action properly.

If you can help me in this updating of the speak function (that is stopping and pausing it as required), it would be really great.

Thanks in advance for your valuable time.

Uttama
Reply With Quote
  #4  
Old 03-22-2009, 10:16 AM
Gladsomebeast Gladsomebeast is offline
Member
 
Join Date: Mar 2005
Location: Isla Vizta, CA
Posts: 397
Dear Mr.Uttama,

Just checked out the speak code in vizact and it looks like if you call vizact.speak with undocumented keyword 'sync' set to True then the audio stops when the action is canceled.

Code:
vizact.speak('jfk.wav', sync=True)
The 'sync' code keeps the mouth flapping and audio syncronized on long speak files. To do this, the code creates an audio object, rather than just calling viz.playsound, the default behevor you were seeing.

Farshizo, perhaps the next release should include viz.playsound(self.filename, viz.STOP) in the end method of VizSpeakAction?
__________________
Paul Elliott
WorldViz LLC
Reply With Quote
  #5  
Old 03-23-2009, 12:29 PM
Uttama_vizard Uttama_vizard is offline
Member
 
Join Date: Sep 2007
Posts: 60
Avatar_speaking problem

Hello,

Thank you so much for your time. Yes, I have also noted that without the sync set to true, the flapping of the avatar's lips with the sound file is not synchronized.

When can we expect the next release with this feature built in? It would be really helpful.

Thanks

Uttama
Reply With Quote
Reply


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Collision of an avatar with a quad Frank Verberne Vizard 8 06-04-2008 10:44 AM
Looking through the eyes of an avatar Frank Verberne Vizard 2 04-01-2008 06:52 AM
Problem with letting an avatar face towards another avatar ghazanfar Vizard 2 03-21-2007 03:30 AM
Avatars in an array and link/unlink betancourtb82 Vizard 7 09-05-2006 05:06 PM
avatars speaking problem shai Vizard 2 11-17-2004 11:13 AM


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


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