BinodNepali
BinodNepali

Reputation: 257

How to change pepper text to speech speed in an android module?

I had been working on developing an android application in the pepper robot using Softbank pepper SDK. I want to change the text to speech speed of the pepper robot. I tried looking different their class packages but I could not find how to set speed before pepper could say something.

Upvotes: 1

Views: 1250

Answers (2)

Ele
Ele

Reputation: 17

You can modify the speed using: tts.setParameter("speed", value)

ex:

self.proxy_tts.post.setParameter("speed", 80)
    self.proxy_tts.post.say(say)
    self.proxy_animation_player.runTag("hello")

Speed value range: [50-400]

Modify speed Speed value range

Upvotes: -1

Dominic D
Dominic D

Reputation: 1808

You can use a number of tags in the text to modify Pepper's text to speech output. There is a list of them here. In this case, you want to use the rspd tag. For normal speed, use \\rspd=100\\, for slower choose a value down to 50, or for faster, up to 400.

For the purposes of this I'll modify the QiSDK Say example in java from here, but the same applies to kotlin.

// Create a phrase.
Phrase phrase = new Phrase("\\rspd=70\\ This is slow \\rspd=200\\ and this is fast!");

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

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

Changing the speed might make the speech sound funny. You can compensate by changing the pitch too.

Phrase phrase = new Phrase("\\rspd=70\\ \\vct=120\\ This is slow.");

You can experiment with the other tags to get almost any effect you want.

Upvotes: 4

Related Questions