Tutorial

This tutorial explains how to say a sentence, change the voice effects, or change the language and the voice of the synthesis engine.

Note:

All the examples provided are written in Python.

Creating a proxy on the module

Before using the TTS commands, you need to create a proxy on the TTS module.

#Creates a proxy on the text-to-speech module from naoqi import ALProxy tts = ALProxy("ALTextToSpeech",IP,9559) #IP = IP address of your robot

Saying a text string

You can say a sentence using the say function.

#Example: Sends a string to the text-to-speech module tts.say("Hello World!")

Modifying pitch

The API allows some modifications of the voice's pitch. Example:

tts.setParameter("pitchShift", 1.1)

This command raises the pitch of the main voice. 1.1 is the ratio between the fundamental frequency of the transformed voice and the original one.

Modifying double voice parameters

The double voice rendering can be modified using 3 parameters:

  • doubleVoice: the ratio between the fundamental frequency of the transformed voice and the original one.
  • doubleVoiceLevel: the ratio between the volume of the second voice and the first one.
  • doubleVoiceTimeShift: the time shift between the second voice and the first one.

For example, a "robotic sounding" voice can be generated using these commands:

tts.setParameter("doubleVoice", 1) tts.setParameter("doubleVoiceLevel", 0.5) tts.setParameter("doubleVoiceTimeShift", 0.1) tts.setParameter("pitchShift", 1.1)

Changing the language of the synthesis engine

The language of the synthesis engine can be changed using the setLanguage function. The list of the available languages can be obtained with the getAvailableLanguages function.

#Example: set the language of the synthesis engine to English: tts.setLanguage("English")

Changing the voice of the synthesis engine

You can also change the voice of the synthesis engine with the setVoice function. The list of the available voices can be obtained with the getAvailableVoices function. When you change the voice, the current language is automatically changed by the language corresponding to this voice.

#Example: use the voice of Kenny: tts.setVoice("Kenny22Enhanced")

Changing the volume of the synthesis

The volume of the text to speech can be changed using the setVolume function. The volume must be between 0.0 and 1.0. The actual volume can be obtained with the getVolume function.

#Example: Adjust the volume of the text to speech to its maximum tts.setVolume(1.0)





Copyright © 2010 Aldebaran-Robotics - All rights reserved