NAOqi Audio - Overview | API | Advanced
The ALAnimatedSpeech module allows you to make the robot talk in an expressive way.
By default, when you make the robot say something through this module, he livens the speech up with body language.
Options
A - The ALAnimatedSpeech module receives a text that can be annotated with instructions.
B - It splits the text into little chunks.
C - It analyzes the text and annotates the things he recognizes to choose contextual moves.
D - Any part of the text which is not annotated with animations are filled with Body language modes.
E - The module prepares the robot to execute each instruction so that it can be executed as soon as it is needed. This enables speech and instructions to be well synchronized.
F - The ALAnimatedSpeech module makes the robot say the text and keeps an eye on the speech to launch instructions at the right time.
The annotated text is a string combining text to be said and Instructions managing behaviors.
For example, you could send:
"Hello! ^start(animations/Stand/Gestures/Hey_1) Nice to meet you!"
In this case:
If you want it to keep running, you can add a ^wait instruction at the end:
"Hello! ^start(animations/Stand/Gestures/Hey_1) Nice to meet you ^wait(animations/Stand/Gestures/Hey_1)"
The following instructions allow you to do some actions during the course of a speech.
Use ... | To ... |
---|---|
^mode( body_language_mode ) | Change the body language mode for the current text. body_language_mode can be “disabled”, “random” or “contextual” |
Example
"Hello. Look I can stop moving ^mode(disabled) and after I can resume moving ^mode(contextual), you see ?"
For further details, see: Body language modes.
Use ... | To ... |
---|---|
^run( animation_full_name ) | Suspend the speech, run an animation and resume the speech. |
^start( animation_full_name ) | Start an animation. |
^stop( animation_full_name ) | Stop an animation. |
^wait( animation_full_name ) | Suspend the speech, wait for the end of the animation and resume the speech. |
Examples
"^start(animations/Stand/Gestures/Enthusiastic_4) Look what I can do while speaking!"
"^start(animations/Stand/Gestures/Enthusiastic_4) Look what I can do while speaking! ^stop(animations/Stand/Gestures/Enthusiastic_4) Now I use my body language"
"^start(animations/Stand/Gestures/Hey_1)Hi, guys! ^wait(animations/Stand/Gestures/Hey_1)"
For further details, see: Animations.
Use ... | To ... |
---|---|
^runTag( tag_name ) | Suspend the speech, run an animation which has the mentioned tag and resume the speech. Chooses randomly the animation which will be started among all the animations which have the mentioned tag. |
^startTag( tag_name ) | Start an animation which has the mentioned tag. Chooses randomly the animation which will be started among all the animations which have the mentioned tag. |
^stopTag( tag_name ) | Stop an animation which has the mentioned tag. |
^waitTag( tag_name ) | Suspend the speech, wait for the end of the animation which has the mentioned tag and resume the speech. |
Examples
"^startTag(me) My name is Nao."
"^startTag(hello) Hello. ^waitTag(hello)"
"^startTag(hello) Hello Paul, nice to meet you. ^stopTag(hello) My name is Nao."
For further details, see : Tags.
Use ... | To ... |
---|---|
^runSound( soundSet/soundFile ) ^runSound( soundSet/soundFile, soundVolume ) |
Suspend the speech, play a sound and resume the speech. soundVolume is an integer between 0 and 100. (by default it’s 100) |
^startSound( soundSet/soundFile ) ^startSound( soundSet/soundFile, soundVolume ) |
Play a sound in background. The volume is an integer between 0 and 100. (by default it’s 100) |
^stopSound( soundSet/soundFile ) | Stop a sound. |
^waitSound( soundSet/soundFile ) | Suspend the speech, wait for the end of the sound and resume the speech. |
Examples
"^startSound(my_sound_set/my_sound) That's cool."
"^startSound(my_sound_set/my_sound, 50) That's cool. ^waitSound(my_sound_set/my_sound)"
"That's cool. ^runSound(my_sound_set/my_sound) "
For further details, see: Sounds.
There is 3 modes available for the body language:
disabled - The body language never launches any animation.
random - The body language launches randomly some short animations which are executed one after another.
You can add new associations between words and tagged animations using: ALAnimatedSpeechProxy::addTagsToWords()
The body language takes all motor resources if they are available. And it stops as soon as they are asked by another animation.
In an annotated text, you can use any supplied animation.
For further details, see:
You can also use your own behaviors provided that you follow these requirements:
For further details, see : Creating a Behavior for annotated text.
In an annotated text, you can use any tag supplied by default.
For further details, see:
Additionally, you can declare new tagged animations using: ALAnimatedSpeechProxy::declareAnimationsPackage()
You can also declare new tags for some specific animations (without modifying the animations) using: ALAnimatedSpeechProxy::declareTagForAnimations()
Note
The tags used by Animated Speech are nothing more than the generic tags you can associate to any behavior. But for Animated Speech, we trust the developers to use only tags that cover animations.
In an annotated text, you can use any sound file contained in a sound set, using the following syntax:
soundSet/soundFile
For further details, see: Soundset.
You can call any NAOqi method or set any event value, at any time of your speech.
Here is the syntax:
ALModule.method(args)
$event=value
Note
$my_event=my_value is equivalent to ^pCall(ALMemory.raiseEvent("my_event", "my_value")).
You can install your own behaviors through the Application Manager panel and uses them in your text.
Warning
As you can call your own behaviors in an annotated text, you could call a behavior which is not an animation. But we advise you to only annotate text with animations. Also we strongly recommend you to set the resources of your behaviors before you start using them in an annotated text.
For further details, see: Creating a Behavior for annotated text.
As ALAnimatedSpeech uses ALTextToSpeech module to say the text, you can customize the voice of the robot.
For further details, see: ALTextToSpeech.
ALAnimatedSpeech uses ALAudioPlayer module to play the sounds.
For further details, see: ALAudioPlayer.
To discover the basic functions of the animated speech using Choregraphe, see the tutorial: Testing the Body language.