$client = new TextToSpeechClient(['credentials' =>
json_decode(file_get_contents('credentials.json'), true)]); //Pass to Google Credentials
$response = $client->listVoices(); //Get Google voices list
$voices = $response->getVoices(); //Get ALL voices, not language specific
如何获取PHP中特定语言的声音列表?
喜欢这个:
$response = $client->listVoices(['languageCode'=>'zh']);
我写过类似的文章,可能对您有帮助:Text Reader using Gcloud TTS