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
|