Voice settings

With Alan, you can customize the voice of your assistant in two ways:

  • At the global level: you can specify voice settings for your assistant at the project level. For details, see Changing the voice, accent and rate.

  • Granularly for every individual intent: you can define how the voice assistant should sound when pronouncing specific phrases.

To customize the voice of your assistant granularly, add the voice() parameter to the play() function. In the voice() parameter, you can define the following voice settings:

Voice setting

Type

Description

language

two-letter language code

Language, or accent, in which the response must be played. Supported languages:

  • English (en)

  • French (fr)

  • German (de)

  • Italian (it)

  • Russian (ru)

  • Spanish (es)

gender

string

Voice gender: male or female

type

number

Voice type: 0 (standard for the selected gender) or 1 (custom voice)

pitch

number

Speaking pitch in the range [-20.0, 20.0], where 20 means increase 20 semitones from the original pitch, -20 means decrease 20 semitones from the original pitch.

speaking rate

number

Speaking rate (speed) in the range [0.25, 4.0], where 1 is normal speed; 2.0 is twice as fast and 0.5 is half as fast.

Note

For languages other than English, some voice settings may not be supported.

Here is how you can use the voice() parameter to play different phrases in different voices:

Voice script
let storyTellerVoice = voice(en, 'male', 0, 0, 1);
let motherVoice = voice(en, 'female', 0, 1, 1);
let redHatVoice = voice(en, 'female', 0, 10, 1.2);

intent("Alan, tell me a fairy tale", p => {
    p.play(storyTellerVoice, "Once upon a time there was a sweet little girl who always wore a cap made of red velvet.");
    p.play(storyTellerVoice, "One day her mother said to her");
    p.play(motherVoice, "Come Little Red Cap. Here is a piece of cake and a bottle of wine. Take them to your grandmother.");
    p.play(storyTellerVoice, "Little Red Cap said");
    p.play(redHatVoice, "I'll do everything just right.");
});