ReviewOS

meemalabs/laravel-text-to-speech

How to change the speed of voice? [BUG]

#20
Closed DelcinoCastelo opened this 8 days ago ·
8 days ago

I need your help!!

8 days ago

Hi @DelcinoCastelo,

Have you taken a look at SSML tags? That should solve your request 👍🏼

8 days ago

I have no idea of how to use. Can you give me some example?

8 days ago

Of course, this little snippet is part of the documentation:

// use the SSML text type in the convert() method.
$path = TextToSpeech::ssml()
    ->convert('<speak>Hi There <break /> This is SSML syntax</speak>');

The supported tags are listed here: https://docs.aws.amazon.com/polly/latest/dg/supportedtags.html

So, in order to change the speed of text read out loud, you would have to check out the "prosody"-tag and the "rate" attribute.

$tts = '<speak>
     For dramatic purposes, you might wish to <prosody rate="slow">slow up the speaking 
     rate of your text.</prosody>                     
</speak>';

$path = TextToSpeech::ssml()
    ->convert($tts);

AWS docs list this:

  • rate

-- x-slow, slow, medium, fast,x-fast. Sets the pitch to a predefined value for the selected voice.

-- n%: A non-negative percentage change in the speaking rate. For example, a value of 100% means no change in speaking rate, a value of 200% means a speaking rate twice the default rate, and a value of 50% means a speaking rate of half the default rate. This value has a range of 20-200%.

8 days ago

It's been 2 weeks, so I will close this in the meantime. Feel free to ping me with any questions!

Sign in to comment on this issue.