stefan.stt
stefan.stt

Reputation: 2627

How to check if Pepper is currently talking

Is there a way to receive information if currently the robot is talking or not. I have looked at ALDialog and ALTextToSpeech APIs, but couldn't find anything useful.

I am looking for something like ALDialog.isSpeaking() that returns 'True' if Pepper is currently saying something and 'False' if he is not talking at the moment of the method invocation.

Upvotes: 0

Views: 377

Answers (2)

Alexandre Mazel
Alexandre Mazel

Reputation: 2558

There's various information posted in ALMemory whom you can subscribe, giving you information about speaking and even more precisely: which word currently spoken...

JVoyage [0] ~ $ qicli call ALMemory.getDataList ALTextToSpeech
["ALTextToSpeech/CurrentSentence","ALTextToSpeech/PositionOfCurrentWord",
"ALTextToSpeech/CurrentBookMark","ALTextToSpeech/TextStarted","ALTextToSpeech/TextDone",
"ALTextToSpeech/Status","ALTextToSpeech/CurrentWord","ALTextToSpeech/TextInterrupted"]

More details: http://doc.aldebaran.com/2-1/naoqi/audio/altexttospeech-api.html#ALTextToSpeech/Status

Upvotes: 4

Anders_K
Anders_K

Reputation: 992

I was also looking for a method like you describe but didn't find any. I made a workaround where I check if the speakers are playing. That would be speaking, playing music, etc.

# initialize
self.boolSpeakersPlaying = True
self.audioDevice = self.session.service("ALAudioDevice")
self.signalID = self.audioDevice.speakersPlaying.connect(self.signalReceived)

#main
def signalReceived(self, arg):
self.logger.info("signal changed to = " + str(arg))
self.boolSpeakersPlaying = arg

def spam(self):
if not self.boolSpeakersPlaying:
    #do something 

Upvotes: 0

Related Questions