Text-to-speech Perl SDK

The Voice RSS Text-to-Speech Perl SDK wraps Voice RSS Text-to-Speech API.

The Voice RSS Text-to-Speech Perl SDKs will help to make integration with our Text-to-Speech API faster and easer.

If you have any questions or suggestions please feel free to contact us via e-mail.

Documentation

To integrate an application with the Voice RSS Text-to-Speech Perl SDK it needs to add reference to the package voicerss_tts. The Voice RSS Text-to-Speech Perl SDK provides possibility to get speech in binary or Base64 string formats.

Convert text-to-speech as a binary array

The following example demonstrates synchronous converting text-to-speech as a binary array and prints result array:

require VoiceRSS_TTS;
use strict;

my $settings = {
    'key' => '<API key>',
    'hl' => 'en-us',
    'v' => 'Linda',
    'src' => 'Hello, world!',
    'r' => '0',
    'c' => 'mp3',
    'f' => '44khz_16bit_stereo',
    'ssml' => 'false',
    'b64' => 'false'
};
my $voice = VoiceRSS_TTS::speech($settings);

print('error: ' . $voice->{'error'} . '\n' . 'response: ' . $voice->{'response'});
                        

Convert text-to-speech as a Base64 string

The following example demonstrates synchronous converting text-to-speech as a Base64 string and plays it in an internet browser:

require VoiceRSS_TTS;
use strict;

my $settings = {
    'key' => '<API key>',
    'hl' => 'en-us',
    'v' => 'Linda',
    'src' => 'Hello, world!',
    'r' => '0',
    'c' => 'mp3',
    'f' => '44khz_16bit_stereo',
    'ssml' => 'false',
    'b64' => 'true'
};
my $voice = VoiceRSS_TTS::speech($settings);

print('<audio src="' . $voice->{'response'} . '" autoplay="autoplay"></audio>');