Say


level_1


Goal - Make Pepper talk.

// Create a phrase.
Phrase phrase = new Phrase("Hello");

// Build the action.
Say say = SayBuilder.with(qiContext)
                    .withPhrase(phrase)
                    .build();

// Run the action synchronously.
say.run();

Typical usage - A pre-established speech, not driven by verbal interaction.


How it works

Defining phrases

To set what Pepper should say, create a Phrase containing the group of words to pronounce, and build the action with it:

Phrase phrase = new Phrase("Hello");
Say say = SayBuilder.with(qiContext)
                    .withPhrase(phrase)
                    .build();

say.run();

Disabling body language

By default, Pepper doesn’t stay motionless while speaking, he makes relevant gestures according to what he is saying: this is his body language.

You can choose to keep this behaviour or to disable it with a BodyLanguageOption.

To disable the body language, use BodyLanguageOption.DISABLED:

Say say = SayBuilder.with(qiContext)
                    .withPhrase(phrase)
                    .withBodyLanguageOption(BodyLanguageOption.DISABLED)
                    .build();

say.run();

See also javadoc: BodyLanguageOption.

Modifying the language

By default Pepper uses his Preferred Language.

To set a different language, use a Locale.

For example, to make Pepper speak French, use Language.FRENCH and Region.FRANCE:

Locale locale = new Locale(Language.FRENCH, Region.FRANCE);
Say say = SayBuilder.with(qiContext)
                    .withPhrase(phrase)
                    .withLocale(locale)
                    .build();

say.run();

See also javadoc: Locale.

Use case

Touristic application

Someone selects a location on the tablet and expects Pepper to give him/her some information about this location.

String locationName = ...;
String locationDescription = ...;

Phrase namePhrase = new Phrase("This location is " + locationName);
Say sayName = SayBuilder.with(qiContext)
                        .withPhrase(namePhrase)
                        .build();

Phrase descriptionPhrase = new Phrase(locationDescription);
Say sayDescription = SayBuilder.with(qiContext)
                               .withPhrase(descriptionPhrase)
                               .build();

sayName.run();
sayDescription.run();

Performance & Limitations

Say or Chat?

Say is suitable when an application requires a short vocal interaction. Prefer Chat to create complex question & answer sequences between Pepper and humans.

Exclusions with other actions

Do not start a Say while a Listen, a Chat or a Discuss is running: the Say would fail.

See also