如何使用PHP语言获取特定语言的Google TextToSpeech语音列表?有一个languageCode参数-在哪里以及如何使用它?

问题描述 投票:0回答:1
$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中特定语言的声音列表?

text-to-speech google-apis-explorer
1个回答
0
投票

喜欢这个:

$response = $client->listVoices(['languageCode'=>'zh']);

我写过类似的文章,可能对您有帮助:Text Reader using Gcloud TTS

© www.soinside.com 2019 - 2024. All rights reserved.