#1
|
|||
|
|||
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 |
#2
|
|||
|
|||
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 |
#3
|
|||
|
|||
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 |
#4
|
|||
|
|||
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) Farshizo, perhaps the next release should include viz.playsound(self.filename, viz.STOP) in the end method of VizSpeakAction?
__________________
Paul Elliott WorldViz LLC |
#5
|
|||
|
|||
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 |
|
|
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 |