[METHOD] Get Human-like Text To Speech Voices

WOW! High quality share. Love this TTS. Thank you so much
 
Thanks for sharing and all the replies also held valuable info about the use of it
 
great one!
Another tip is aws polly. It can be used for free through api for about 1000-req per day.
 
Not bad, might be useful. Thank you for the share.
 
I found this in my archive. Maybe someone finds it useful? Can be run from terminal. I used it for radio commercials. It became really good!
PHP:
<?php
/**
USAGE

1. You must have composer installed, if not, https://getcomposer.org
2. in a terminal, run `composer install`
3. Change to your aws keys in the top of the file. You can signup on AWS for free.
4. change text and output file and voice in function synthesizeSpeech

*/

putenv("AWS_ACCESS_KEY_ID=xxxxxxxxxxx"); // replace xxxx with your access key (free)
putenv("AWS_SECRET_ACCESS_KEY=xxxxxxxxxxxx"); // replace with your secret key

require_once(__DIR__ . "/vendor/autoload.php"); // autoload all dependencies
use Aws\Exception\AwsException;
use Aws\Polly\PollyClient;

/**
* Calls polly and saves speechfile to outputfile
*/
function synthesizeSpeech($text, $outputfile, $voice = "random") {
    $voices = [
        "Geraint",    "Gwyneth",    "Mads",    "Naja",    "Hans",    "Marlene",    "Nicole",    "Russell",    "Amy",    "Brian",    "Emma",    "Raveena",    "Ivy",    "Joanna",    "Joey",    "Justin",     "Kendra",     "Kimberly",     "Matthew",     "Salli",     "Conchita",     "Enrique",
         "Miguel",     "Penelope",     "Chantal",     "Celine",     "Lea",     "Mathieu",     "Dora",     "Karl",     "Carla",     "Giorgio",     "Mizuki",     "Liv",     "Lotte",     "Ruben",     "Ewa",     "Jacek",     "Jan",     "Maja",     "Ricardo",     "Vitoria",      "Cristiano",
         "Ines",     "Carmen",     "Maxim",     "Tatyana",     "Astrid",     "Filiz",     "Vicki",     "Takumi",     "Seoyeon",     "Aditi",     "Zhiyu",     "Bianca",     "Lucia",     "Mia"
    ];
    if($voice == "random")$voice = $voices[ rand(0,count($voices)-1)];
    $format = "mp3";
    $credentials = new Aws\Credentials\Credentials(getenv('AWS_ACCESS_KEY_ID'), getenv('AWS_SECRET_ACCESS_KEY'));
    $client = new Aws\Polly\PollyClient([
        'version' => '2016-06-10',
        'region' => 'us-east-2',
        'credentials' => [
            'key'    => getenv('AWS_ACCESS_KEY_ID'),
            'secret' => getenv('AWS_SECRET_ACCESS_KEY'),
        ],
    ]); 
    try {
        $result = $client->synthesizeSpeech([
            'Text' => $text,
            'TextType' => 'text',
            'OutputFormat' => $format,
            'VoiceId' => $voice,
  
        ]);
        $song = $result->get('AudioStream')->getContents();
        file_put_contents($outputfile, $song);
    } catch (AwsException $e) {
        // output error message if fails
        echo $e->getMessage();
        echo "\n";
    } 
}

// example one, write one file
synthesizeSpeech("Get fifty-percent discount. Sign up today.", "output.mp3", "random");

// example two, synthesize a whole book
$files=[
    'chapter1.txt',
    'chapter2.txt',
    'chapter3.txt',
       ];

foreach($files as $file) {
    $data = file_get_contents(__DIR__."/".$file);
    synthesizeSpeech($data, $file.".mp3", "Astrid");
    die();
}
 
is IBM gonna come after you if you use if for commercial purpose? I want to pair it with youtube + affiliate marketing.
How are you planning on adding the voice to YouTube video. I really want to try it out
 
How are you planning on adding the voice to YouTube video. I really want to try it out

First you write the script, then paste the text into website and generate the mp3 file which you'll add to your video file in any video editing software.
 
Back
Top