# SoftBank Robotics documentation What's new in NAOqi 2.8?

# ALTextToSpeech API

NAOqi Audio - Overview | API | Tutorial

Namespace : AL

    #include <alproxies/altexttospeechproxy.h>

## Method list

As any module, this module inherits methods from ALModule API. It also has the following specific methods:

class `ALTextToSpeechProxy`

- `ALTextToSpeechProxy::addToDictionary`
- `ALTextToSpeechProxy::deleteFromDictionary`
- `ALTextToSpeechProxy::getAvailableLanguages`
- `ALTextToSpeechProxy::getAvailableVoices`
- `ALTextToSpeechProxy::getLanguage`
- `ALTextToSpeechProxy::getParameter`
- `ALTextToSpeechProxy::getSupportedLanguages`
- `ALTextToSpeechProxy::getVoice`
- `ALTextToSpeechProxy::getVolume`
- `ALTextToSpeechProxy::locale`
- `ALTextToSpeechProxy::resetSpeed`
- `ALTextToSpeechProxy::say`
- `ALTextToSpeechProxy::sayToFile`
- `ALTextToSpeechProxy::setLanguage`
- `ALTextToSpeechProxy::setLanguageDefaultVoice`
- `ALTextToSpeechProxy::setParameter`
- `ALTextToSpeechProxy::setVoice`
- `ALTextToSpeechProxy::setVolume`
- `ALTextToSpeechProxy::showDictionary`
- `ALTextToSpeechProxy::stopAll`

Deprecated methods

- `ALTextToSpeechProxy::loadVoicePreference`

## Event list

- `ALTextToSpeech/CurrentBookMark()`
- `ALTextToSpeech/CurrentSentence()`
- `ALTextToSpeech/CurrentWord()`
- `ALTextToSpeech/PositionOfCurrentWord()`
- `ALTextToSpeech/Status()`
- `ALTextToSpeech/TextStarted()`
- `ALTextToSpeech/TextDone()`
- `ALTextToSpeech/TextInterrupted()`

## Signal list

- `ALTextToSpeech::synchroTTS`
- `ALTextToSpeech::languageTTS`

## Methods

bool `ALTextToSpeechProxy::``addToDictionary`(const std::string& word, const std::string& pronunciation)

  Nuance only.

  Changes the pronunciation of a word in the current language. The new pronunciation is stored on the robot, so it will remain even if the robot is switched off.

  Parameters: | word – word to change. pronunciation – new pronunciation of the word.
  Returns: | true if succeeded otherwise false

  `altexttospeech_userdictionary.py`

      #! /usr/bin/env python
      # -*- encoding: UTF-8 -*-

      """Example: Use Dictionary TTS Methods (English)"""

      import qi
      import argparse
      import sys

      def main(session):
          """
          This example uses the Dictionary TTS methods (English).
          It adds and removes words in the dictionary from the module.
          """
          # Get the service ALTextToSpeech.

          tts = session.service("ALTextToSpeech")

          tts.setLanguage("English")
          # Say Emile in english
          tts.say("My name is Emile.")

          # Add Emile to dictionary
          tts.addToDictionary("Emile", "\\toi=lhp\\E'mil\\toi=orth\\")

          # Test it
          tts.say("My name is Emile.")

          # Delete the word Emile
          tts.deleteFromDictionary ("Emile")

          # Re-test it
          tts.say("My name is Emile.")

      if __name__ == "__main__":
          parser = argparse.ArgumentParser()
          parser.add_argument("--ip", type=str, default="127.0.0.1",
                              help="Robot IP address. On robot or Local Naoqi: use '127.0.0.1'.")
          parser.add_argument("--port", type=int, default=9559,
                              help="Naoqi port number")

          args = parser.parse_args()
          session = qi.Session()
          try:
              session.connect("tcp://" + args.ip + ":" + str(args.port))
          except RuntimeError:
              print ("Can't connect to Naoqi at ip \"" + args.ip + "\" on port " + str(args.port) +".\n"
                     "Please check your script arguments. Run with -h option for help.")
              sys.exit(1)
          main(session)

bool `ALTextToSpeechProxy::``addToDictionary`(const std::string& type, const std::string& word, const std::string& priority, const std::string& phonetic, const std::string& accent)

  Japanese only.

  Adds the specific string in the dictionary with its type, pronunciation and priority. Changes the pronunciation of a word. The new pronunciation is stored on the robot, so it will remain even if the robot is switched off.

  Parameters: | type – the word type (名詞-一般, 名詞-固有名詞-人名-一般, 名詞-固有名詞-人名-姓, 名詞-固有名詞-人名-名, 名詞-固有名詞-地域-一般, 名詞-固有名詞-一般, 名詞-サ変接続, 名詞-形容動詞語幹, 記号-一般) word – the word to add in Hiragana, katakana or kanji. priority – the priority of the word(1 to 9999). phonetic – the word phonetic : same as word in KATAKANA.. accent – the accentuation of the chosen syllabus.
  Returns: | true if succeeded otherwise false

  `altexttospeech_userdictionary.py`

      #! /usr/bin/env python
      # -*- encoding: UTF-8 -*-

      """Example: Use Dictionary TTS Methods (Japanese)"""

      import qi
      import argparse
      import sys

      def main(session):
          """
          This example uses the Dictionary TTS methods.
          It adds and removes words in the dictionary from the module.
          """
          # Get the service ALTextToSpeech.

          tts = session.service("ALTextToSpeech")
          try :
              tts.setLanguage("Japanese")
          except RuntimeError:
              print "You need to install Japanese language in order to hear correctly these sentences."
          #Check the pronunciation before changing the dictionary
          tts.say("日本語")

          #Add the word  おはよう
          tts.addToDictionary("名詞-一般","日本語","2000" , "ニホンゴ","3-4:*")

          #Test it
          tts.say("日本語")

          #Delete this word in the dictionary to reset the pronunciation
          tts.deleteFromDictionary ("名詞-一般","日本語")

          #Re-test it
          tts.say("日本語")

      if __name__ == "__main__":
          parser = argparse.ArgumentParser()
          parser.add_argument("--ip", type=str, default="127.0.0.1",
                              help="Robot IP address. On robot or Local Naoqi: use '127.0.0.1'.")
          parser.add_argument("--port", type=int, default=9559,
                              help="Naoqi port number")

          args = parser.parse_args()
          session = qi.Session()
          try:
              session.connect("tcp://" + args.ip + ":" + str(args.port))
          except RuntimeError:
              print ("Can't connect to Naoqi at ip \"" + args.ip + "\" on port " + str(args.port) +".\n"
                     "Please check your script arguments. Run with -h option for help.")
              sys.exit(1)
          main(session)

bool `ALTextToSpeechProxy::``deleteFromDictionary`(const std::string& word)

  Nuance only.

  Deletes the word from the user dictionary.

  Parameters: | word – word to delete, encoded in UTF-8.
  Returns: | true if succeeded otherwise false

bool `ALTextToSpeechProxy::``deleteFromDictionary`(const std::string& type, const std::string& word)

  Japanese only.

  Deletes the word according to its type from the japanese user dictionary.

  Parameters: | word – the word to delete in Hiragana, katakana or kanji. type – the word type (noun, verb, ...)
  Returns: | true if succeeded otherwise false

std::vector<std::string> `ALTextToSpeechProxy::``getAvailableLanguages`()

  Returns the list of the languages currently installed on the system.

  Returns: | a list of languages. Example: [‘French’, ‘Chinese’, ‘English’, ‘Japanese’] A subset of the supported languages: `ALTextToSpeechProxy::getSupportedLanguages` See also: Supported languages, Supported languages.

  `altexttospeech_getavailablelanguages.py`

      #! /usr/bin/env python
      # -*- encoding: UTF-8 -*-

      """Example: Use getAvalaibleLanguages Method"""

      import qi
      import argparse
      import sys

      def main(session):
          """
          This example uses the getAvailableLanguages method.
          It gets the list of languages available in the module.
          """
          # Get the service ALTextToSpeech.

          tts = session.service("ALTextToSpeech")

          #Lists the available languages
          lang = tts.getAvailableLanguages();
          print "Available languages: " + str(lang)

      if __name__ == "__main__":
          parser = argparse.ArgumentParser()
          parser.add_argument("--ip", type=str, default="127.0.0.1",
                              help="Robot IP address. On robot or Local Naoqi: use '127.0.0.1'.")
          parser.add_argument("--port", type=int, default=9559,
                              help="Naoqi port number")

          args = parser.parse_args()
          session = qi.Session()
          try:
              session.connect("tcp://" + args.ip + ":" + str(args.port))
          except RuntimeError:
              print ("Can't connect to Naoqi at ip \"" + args.ip + "\" on port " + str(args.port) +".\n"
                     "Please check your script arguments. Run with -h option for help.")
              sys.exit(1)
          main(session)

std::vector<std::string> `ALTextToSpeechProxy::``getAvailableVoices`()

  Returns the list of the voices currently installed on the system. Each voice name is given in English.

  Returns: | Voices Installed

std::string `ALTextToSpeechProxy::``getLanguage`()

  Returns the language currently used by the text to speech engine.

  Returns: | a language name. Example: ‘French’ Could be one of the installed languages: `ALTextToSpeechProxy::getAvailableLanguages` See also: Supported languages, Supported languages.

float `ALTextToSpeechProxy::``getParameter`(const std::string& parameter)

  Returns the value of one of the text to speech engine parameters. The available parameters are: “pitchShift”, “doubleVoice”,”doubleVoiceLevel” and “doubleVoiceTimeShift”. Please refers to `ALTextToSpeechProxy::setParameter` for details about this parameters.

  Parameters: | parameter – Name of the parameter
  Returns: | Value of the specified parameter

std::vector<std::string> `ALTextToSpeechProxy::``getSupportedLanguages`()

  Returns the list of all supported languages.

  Returns: | a list of languages. Example: [‘French’, ‘Chinese’, ‘English’, ‘German’, ‘Italian’, ‘Japanese’, ‘Korean’, ‘Portuguese’, ‘Spanish’] See also: Supported languages, Supported languages.

      #! /usr/bin/env python
      # -*- encoding: UTF-8 -*-

      """Example: Use getSupportedLanguages Method"""

      import qi
      import argparse
      import sys

      def main(session):
          """
          This example uses the getSupportedLanguages method.
          It gets the list of supported languages by the module.
          """
          # Get the service ALTextToSpeech.

          tts = session.service("ALTextToSpeech")

          #Lists the supported languages
          lang = tts.getSupportedLanguages();
          print "Supported languages: " + str(lang)

      if __name__ == "__main__":
          parser = argparse.ArgumentParser()
          parser.add_argument("--ip", type=str, default="127.0.0.1",
                              help="Robot IP address. On robot or Local Naoqi: use '127.0.0.1'.")
          parser.add_argument("--port", type=int, default=9559,
                              help="Naoqi port number")

          args = parser.parse_args()
          session = qi.Session()
          try:
              session.connect("tcp://" + args.ip + ":" + str(args.port))
          except RuntimeError:
              print ("Can't connect to Naoqi at ip \"" + args.ip + "\" on port " + str(args.port) +".\n"
                     "Please check your script arguments. Run with -h option for help.")
              sys.exit(1)
          main(session)

std::string `ALTextToSpeechProxy::``getVoice`()

  Returns the voice currently used by the text to speech engine.

  Returns: | Name of the current voice

float `ALTextToSpeechProxy::``getVolume`()

  Gets the current gain applied to the signal synthesized by the text to speech engine. The default value is 1.0.

  Returns: | Volume [0 - 1]

void `ALTextToSpeechProxy::``loadVoicePreference`(const std::string& preferencesFileSuffix)

  Deprecated since version 2.3: Please use `ALTextToSpeechProxy::setParameter` to change the settings of the voice. To save your settings please use ALPreferenceManager. For further details see ALPreferenceManager.

  Loads a voice and the related set of voice parameters defined in a XML file contained in the preferences folder. The name of the XML file must be of the form ALTextToSpeech_Voice_preferencesFileSuffix. The official voice in each language is defined in this way. Please refers to Tutorial for further details.

  Parameters: | preferencesFileSuffix – Name of the voice preference file

std::string `ALTextToSpeechProxy::``locale`()

  Returns the locale associated to the current language set on the robot.

  Returns: | The locale associated to the current language. Example: ‘en_US’ See also: Supported languages, Supported languages.

void `ALTextToSpeechProxy::``resetSpeed`()

  Reset the speed of the speech to the value stored in the parameter defaultVoiceSpeed.

void `ALTextToSpeechProxy::``say`(const std::string& stringToSay)
  - ALTextToSpeechProxy::say
  - ALTextToSpeechProxy::say with language setting

  Says the specified string of characters.

  Uses the:

  1. language temporarily defined using `ALTextToSpeechProxy::setLanguage` if any, or

  2. preferred language, or

  3. falback language.

     For further details, see: Setting NAO’s preferred language Setting Pepper’s preferred language.

  Parameters: | stringToSay – Text to say, encoded in UTF-8.

  `altexttospeech_say.py`

      #! /usr/bin/env python
      # -*- encoding: UTF-8 -*-

      """Example: Use say Method"""

      import qi
      import argparse
      import sys

      def main(session):
          """
          This example uses the say method.
          It makes the robot say some text using the module.
          """
          # Get the service ALTextToSpeech.
          tts = session.service("ALTextToSpeech")

          #Says a test std::string
          tts.say("This is a sample text!")

      if __name__ == "__main__":
          parser = argparse.ArgumentParser()
          parser.add_argument("--ip", type=str, default="127.0.0.1",
                              help="Robot IP address. On robot or Local Naoqi: use '127.0.0.1'.")
          parser.add_argument("--port", type=int, default=9559,
                              help="Naoqi port number")

          args = parser.parse_args()
          session = qi.Session()
          try:
              session.connect("tcp://" + args.ip + ":" + str(args.port))
          except RuntimeError:
              print ("Can't connect to Naoqi at ip \"" + args.ip + "\" on port " + str(args.port) +".\n"
                     "Please check your script arguments. Run with -h option for help.")
              sys.exit(1)
          main(session)

void `ALTextToSpeechProxy::``say`(const std::string& stringToSay, const std::string& language)

  Says the specified string of characters in the specified language.

  Parameters: | stringToSay – Text to say, encoded in UTF-8. language – Name of one of the available languages. Example: ‘French’ See: `ALTextToSpeechProxy::getAvailableLanguages`.

  `altexttospeech_altexttospeech_say2.py`

      #! /usr/bin/env python
      # -*- encoding: UTF-8 -*-

      """Example: Use say Method"""

      import qi
      import argparse
      import sys

      def main(session):
          """
          This example uses the say method to make the robot speak.
          If French is installed, it will use the French pronunciation for "voiture"
          Else, it will try to say it in English.
          """
          # Get the service ALTextToSpeech.

          tts = session.service("ALTextToSpeech")

          #Sets the language to English
          tts.setLanguage("English")

          tts.say("Let me teach you some French words.")
          tts.say("In French, we say")
          try :
              tts.say("voiture", "French")
          except RuntimeError:
              print "French language is not installed, please install it to have a French pronunciation."
              tts.say("voiture", "English")
          tts.say("for car")

      if __name__ == "__main__":
          parser = argparse.ArgumentParser()
          parser.add_argument("--ip", type=str, default="127.0.0.1",
                              help="Robot IP address. On robot or Local Naoqi: use '127.0.0.1'.")
          parser.add_argument("--port", type=int, default=9559,
                              help="Naoqi port number")

          args = parser.parse_args()
          session = qi.Session()
          try:
              session.connect("tcp://" + args.ip + ":" + str(args.port))
          except RuntimeError:
              print ("Can't connect to Naoqi at ip \"" + args.ip + "\" on port " + str(args.port) +".\n"
                     "Please check your script arguments. Run with -h option for help.")
              sys.exit(1)
          main(session)

void `ALTextToSpeechProxy::``sayToFile`(const std::string& stringToSay, const std::string& fileName)

  Works similarly to `ALTextToSpeechProxy::say` but the synthesized signal is recorded into the specified file instead of being sent to the robot’s loudspeakers. The signal is encoded with a sample rate of 22050Hz (European languages) and 16000Hz (Asian languages), format S16_LE, 1 channel.

  Parameters: | stringToSay – Text to be synthesized, encoded in UTF-8. fileName – file where the synthesized signal should be recorded (can be either a .raw file or a .wav file).

  `altexttospeech_saytofile.py`

      #! /usr/bin/env python
      # -*- encoding: UTF-8 -*-

      """Example: Use sayToFile Method"""

      import qi
      import argparse
      import sys

      def main(session):
          """
          This example uses the sayToFile method.
          It makes the robot say some text using the module,
          And write it in a file.
          """
          # Get the service ALTextToSpeech.

          tts = session.service("ALTextToSpeech")

          #Says a test std::string, and save it into a file
          tts.sayToFile("This is a sample text, written in a file!", "/tmp/sample_text.raw")

          #Says a test std::string, and save it into a file
          tts.sayToFile("This is another sample text", "/tmp/sample_text.wav")

      if __name__ == "__main__":
          parser = argparse.ArgumentParser()
          parser.add_argument("--ip", type=str, default="127.0.0.1",
                              help="Robot IP address. On robot or Local Naoqi: use '127.0.0.1'.")
          parser.add_argument("--port", type=int, default=9559,
                              help="Naoqi port number")

          args = parser.parse_args()
          session = qi.Session()
          try:
              session.connect("tcp://" + args.ip + ":" + str(args.port))
          except RuntimeError:
              print ("Can't connect to Naoqi at ip \"" + args.ip + "\" on port " + str(args.port) +".\n"
                     "Please check your script arguments. Run with -h option for help.")
              sys.exit(1)
          main(session)

void `ALTextToSpeechProxy::``setLanguage`(const std::string& language)

  Sets the language used by the text to speech system for the current application.

  The setting will come back to the preferred language at the end of the application.

  For further details, see: Setting NAO’s preferred language Setting Pepper’s preferred language.

  Parameters: | language – Name of one of the available languages. Example: ‘French’ See: `ALSpeechRecognitionProxy::getAvailableLanguages`.

void `ALTextToSpeechProxy::``setLanguageDefaultVoice`(const std::string& language, const std::string& voice)

  Sets the voice to be used by default with a specified language.

  Parameters: | language – the language among those available on the robot. See: `ALSpeechRecognitionProxy::getAvailableLanguages`. voice – the voice among those available for this language on the robot.

void `ALTextToSpeechProxy::``setParameter`(const std::string& parameter, const float& value)

  Sets parameters of the text to speech engine.

  Parameters: | parameter – Name of the parameter value – Value of the parameter

  The available parameters are specific to the speech engine:

  — All languages —

  Parameters | Description
  --- | ---
  pitchShift | applies a pitch shift to the voice. The value indicates the ratio between the new fundamental frequencies and the original one (examples: 2.0: an octave above, 1.5: a quint above). Acceptable range is [1.0 - 4]. 0 disables the effect.
  doubleVoice | adds a second voice to the first one. The value indicates the ratio between the second voice fundamental frequency and the first one. Acceptable range is [1.0 - 4]. 0 disables the effect.
  doubleVoiceLevel | sets the gain of the additional voice compared to the original one. Acceptable range is [0 - 4]. 0 disables the effect.
  doubleVoiceTimeShift | sets the delay (seconds) between the doubled voice and the original one. Acceptable range is [0 - 0.5].
  speed | sets the current voice speed. The default value is 100. Acceptable range is [50 - 400].
  defaultVoiceSpeed | sets the default speed of the voice. The speed will be set to this value when `ALTextToSpeechProxy::resetSpeed` is called. Setting this parameter also resets the speed. Acceptable range is [50 - 400].

  — Nuance and Voxygen packages only —

  Parameters | Acceptable range
  --- | ---
  volume | [0 - 100]
  pitch | [50 - 200]

  — Japanese only —

  Parameters | Description
  --- | ---
  enableCompression | Enables the audio dynamic compression on the speech. This will increase the global volume of the voice. 0 activate the audio dynamic compression 1 deactivate the audio dynamic compression

  Parameters | Acceptable range
  --- | ---
  volume | [0.00001 - 2.0]
  pitch | [0.5 - 2.0]
  emph | [0.0 - 2.0]
  pauseMiddle | [80.0 and 300.0]
  pauseLong | [300.0 - 2000.0]
  pauseSentence | [80.0 and 10000.0]

  `altexttospeech_setparameter.py`

      #! /usr/bin/env python
      # -*- encoding: UTF-8 -*-

      """Example: Use setParameter Method"""

      import qi
      import argparse
      import sys

      def main(session):
          """
          This example uses the setParameter method.
          It sets the pitchShift to use in the module.
          """
          # Get the service ALTextToSpeech.

          tts = session.service("ALTextToSpeech")

          #Applies a pitch shifting to the voice
          tts.setParameter("pitchShift", 1.5)
          #Deactivates double voice
          tts.setParameter("doubleVoice", 0.0)

          tts.say("Pitch shift and double voice changed")

      if __name__ == "__main__":
          parser = argparse.ArgumentParser()
          parser.add_argument("--ip", type=str, default="127.0.0.1",
                              help="Robot IP address. On robot or Local Naoqi: use '127.0.0.1'.")
          parser.add_argument("--port", type=int, default=9559,
                              help="Naoqi port number")

          args = parser.parse_args()
          session = qi.Session()
          try:
              session.connect("tcp://" + args.ip + ":" + str(args.port))
          except RuntimeError:
              print ("Can't connect to Naoqi at ip \"" + args.ip + "\" on port " + str(args.port) +".\n"
                     "Please check your script arguments. Run with -h option for help.")
              sys.exit(1)
          main(session)

void `ALTextToSpeechProxy::``setVoice`(const std::string& voiceID)

  Changes the voice used by the text-to-speech engine. The voice identifier must belong to the installed voices, that can be listed using the `ALTextToSpeechProxy::getAvailableVoices` method.

  Parameters: | voiceID – Name of the voice

  `altexttospeech_setvoice.py`

      #! /usr/bin/env python
      # -*- encoding: UTF-8 -*-

      """Example: Use setVoice Method"""

      import qi
      import argparse
      import sys

      def main(session):
          """
          This example uses the setVoice method.
          It sets the voice to use in the module.
          """
          # Get the service ALTextToSpeech.

          tts = session.service("ALTextToSpeech")

          #Changes the basic voice of the synthesis
          tts.setVoice("naoenu")

          tts.say("Voice changed to naoenu")

      if __name__ == "__main__":
          parser = argparse.ArgumentParser()
          parser.add_argument("--ip", type=str, default="127.0.0.1",
                              help="Robot IP address. On robot or Local Naoqi: use '127.0.0.1'.")
          parser.add_argument("--port", type=int, default=9559,
                              help="Naoqi port number")

          args = parser.parse_args()
          session = qi.Session()
          try:
              session.connect("tcp://" + args.ip + ":" + str(args.port))
          except RuntimeError:
              print ("Can't connect to Naoqi at ip \"" + args.ip + "\" on port " + str(args.port) +".\n"
                     "Please check your script arguments. Run with -h option for help.")
              sys.exit(1)
          main(session)

void `ALTextToSpeechProxy::``setVolume`(const float& volume)

  Sets the current gain applied to the signal synthesized by the text to speech engine. The default value is 1.0.

  Parameters: | volume – Gain

  `altexttospeech_setvolume.py`

      #! /usr/bin/env python
      # -*- encoding: UTF-8 -*-

      """Example: Use setVolume Method"""

      import qi
      import argparse
      import sys

      def main(session):
          """
          This example uses the setVolume method.
          It sets the volume to use in the module.
          """
          # Get the service ALTextToSpeech.

          tts = session.service("ALTextToSpeech")

          #Changes the volume
          tts.setVolume(0.5)
          tts.say("Volume set to 50%")

      if __name__ == "__main__":
          parser = argparse.ArgumentParser()
          parser.add_argument("--ip", type=str, default="127.0.0.1",
                              help="Robot IP address. On robot or Local Naoqi: use '127.0.0.1'.")
          parser.add_argument("--port", type=int, default=9559,
                              help="Naoqi port number")

          args = parser.parse_args()
          session = qi.Session()
          try:
              session.connect("tcp://" + args.ip + ":" + str(args.port))
          except RuntimeError:
              print ("Can't connect to Naoqi at ip \"" + args.ip + "\" on port " + str(args.port) +".\n"
                     "Please check your script arguments. Run with -h option for help.")
              sys.exit(1)
          main(session)

void `ALTextToSpeechProxy::``showDictionary`()

  Nuance and Japanese only.

  Shows the user dictionary of the current language in the logs of naoqi if there is one available.

void `ALTextToSpeechProxy::``stopAll`()

  This method stops the current and all the pending tasks immediately.

## Events

Event: `"ALTextToSpeech/CurrentBookMark"`
callback(std::string eventName, int value, std::string subscriberIdentifier)

  Indicates the occurrence of the bookmarks that are placed (using “mrk=number” number being an integer [0 - 65535]) in the string that needs to be synthesized.

  For further information, see: `Acapela Mobility Text TAGS`.

  Parameters: | eventName (std::string) – “ALTextToSpeech/CurrentBookMark” value – Current bookmark. subscriberIdentifier (std::string) –

Event: `"ALTextToSpeech/CurrentSentence"`
callback(std::string eventName, std::string value, std::string subscriberIdentifier)

  Indicates the sentence that is currently synthesized.

  Parameters: | eventName (std::string) – “ALTextToSpeech/CurrentSentence” value – Current sentence. subscriberIdentifier (std::string) –

Event: `"ALTextToSpeech/CurrentWord"`
callback(std::string eventName, std::string value, std::string subscriberIdentifier)

  Indicates the word that is currently synthesized.

  Not relevant on a simulated robot.

  Warning

  Not available for Japanese engine.

  Parameters: | eventName (std::string) – “ALTextToSpeech/CurrentWord” value – Current word. subscriberIdentifier (std::string) –

Event: `"ALTextToSpeech/PositionOfCurrentWord"`
callback(std::string eventName, int value, std::string subscriberIdentifier)

  Indicates the word that is currently synthesized by its index in the current sentence. Index 0 refers to the first word of the sentence.

  Warning

  Not available for Japanese engine.

  Parameters: | eventName (std::string) – “ALTextToSpeech/PositionOfCurrentWord” value – Current word position. subscriberIdentifier (std::string) –

Event: `"ALTextToSpeech/Status"`
callback(std::string eventName, AL::ALValue value, std::string subscriberIdentifier)

  Raised when the status of a task changes.

  Parameters: | eventName (std::string) – “ALTextToSpeech/Status” value – [idOfConcernedTask, status] Where: idOfConcernedTask is the ID of the task concerned by the event. status can be “enqueued”, “started”, “thrown”, “stopped” or “done”. subscriberIdentifier (std::string) –

Event: `"ALTextToSpeech/TextStarted"`
callback(std::string eventName, bool value, std::string subscriberIdentifier)

  Raised when the current sentence synthesis starts.

  Parameters: | eventName (std::string) – “ALTextToSpeech/TextStarted” value – True if the current speaking task is in progress. subscriberIdentifier (std::string) –

Event: `"ALTextToSpeech/TextDone"`
callback(std::string eventName, bool value, std::string subscriberIdentifier)

  Raised when the current sentence synthesis is done.

  Parameters: | eventName (std::string) – “ALTextToSpeech/TextDone” value – True if the current speaking task is done. subscriberIdentifier (std::string) –

Event: `"ALTextToSpeech/TextInterrupted"`
callback(std::string eventName, bool value, std::string subscriberIdentifier)

  Raised when the current sentence synthesis is interrupted, for example by `ALTextToSpeechProxy::stopAll`.

  Parameters: | eventName (std::string) – “ALTextToSpeech/TextInterrupted” value – True if the current speaking task is interrupted. subscriberIdentifier (std::string) –

## Signals

qi::Signal<qi::os::timeval> `ALTextToSpeech::``synchroTTS`

  During a dialog session, the robot switches between speaking phase and listening phase. This signal is raised only at the end of the last sentence of the speaking phase to indicate the beginning of the listening phase. Time value contains the remaining sound to be played before the actual end of the speech.

qi::Signal<std::string> `ALTextToSpeech::``languageTTS`

  Raised each time the language used by the text to speech engine is successfully changed. The string contains the locale code corresponding to the language set.

  To see the correspondance between this code and its language, see: Supported languages, Supported languages.

Glossary Site map Index Support Contact Legal Notices