\duncan3dc\Speaker\ProvidersAcapelaProvider

Convert a string of a text to spoken word audio.

Summary

Methods
Properties
Constants
setClient()
getClient()
getFormat()
getOptions()
__construct()
withVoice()
withSpeed()
textToSpeech()
No public properties found
No constants found
sendRequest()
No protected properties found
N/A
getVoice()
getSpeed()
$client
$login
$application
$password
$voice
$speed
N/A

Properties

$client

$client : \GuzzleHttp\ClientInterface

Type

\GuzzleHttp\ClientInterface — A guzzle instance for http requests.

$login

$login : string

Type

string — Your acapela login.

$application

$application : string

Type

string — Your acapela application.

$password

$password : string

Type

string — Your acapela password.

$voice

$voice : string

Type

string — The voice to use.

$speed

$speed : integer

Type

integer — The speech rate.

Methods

setClient()

setClient(\GuzzleHttp\ClientInterface  $client) : \duncan3dc\Speaker\Providers\ProviderInterface

Get the guzzle client instance to use.

Parameters

\GuzzleHttp\ClientInterface $client

Returns

\duncan3dc\Speaker\Providers\ProviderInterface

getClient()

getClient() : \GuzzleHttp\ClientInterface

Get the guzzle client.

Returns

\GuzzleHttp\ClientInterface

getFormat()

getFormat() : string

Get the format of this audio.

Returns

string

getOptions()

getOptions() : array

Get the current options.

This is used in caching to determine if we have sent a request with these options before and can use the previous result.

Returns

array

__construct()

__construct(string  $login, string  $application, string  $password, string  $voice = null, integer  $speed = null) 

Create a new instance.

Parameters

string $login

The username to access the service

string $application

The name of the application

string $password

The password to access the service

string $voice

The voice to use

integer $speed

The speech rate

withSpeed()

withSpeed(integer  $speed) : self

Set the speech rate to use.

Parameters

integer $speed

The speech rate to use (between 60 and 360)

Returns

self

textToSpeech()

textToSpeech(string  $text) : string

Convert the specified text to audio.

Parameters

string $text

The text to convert

Returns

string —

The audio data

sendRequest()

sendRequest(string  $hostname, array<mixed,string>  $params) : string

Send a http request.

Parameters

string $hostname

The hostname to send the request to

array<mixed,string> $params

The parameters of the request

Returns

string —

The response body

getVoice()

getVoice(string  $voice) : string

Check if the voce is valid, and convert it to the required format.

Parameters

string $voice

The voice to use

Returns

string

getSpeed()

getSpeed(integer  $speed) : integer

Check the speech rate is valid.

Parameters

integer $speed

The speech rate to use

Returns

integer