mathsgod/microsoft-tts

Microsoft Text-to-Speech API for PHP

1.0.0 2023-07-04 08:14 UTC

This package is auto-updated.

Last update: 2024-04-04 10:54:01 UTC


README

Installation

composer require mathsgod/microsoft-tts

Usage

use Microsoft\CognitiveServices\Speech\TTS;

require __DIR__ . '/vendor/autoload.php';

$region="eastasia";
$key='YOUR_KEY';
$tts = new TTS($key, $region);
$tts->save('Hello World', 'hello-world.mp3');

Format and Voice

$format=TTS::AUDIO_24KHZ_160KBITRATE_MONO_MP3;
$voice="zh-HK-HiuGaaiNeural";
$tts->save('Hello World', 'hello-world.mp3', $format, $voice);

Get voices list

$voices=$tts->getVoicesList();