我正在用php调用Google Text to Speech的rest API.
我是这样打电话的:
$url = "https://texttospeech.googleapis.com/v1/text:synthesize?key=".$key;
$data = array(
'input' => array(
'ssml' => $testo
),
'voice' => array(
"languageCode" => "en-us",
"name" => "en-US-Wavenet-I",
"ssmlGender" => "MALE"
),
'audioConfig' => array(
'audioEncoding' => "LINEAR16",
"effectsProfileId" => [
"small-bluetooth-speaker-class-device"
],
"speakingRate" => 1,
"pitch" => 4,
)
);
$options = array(
'http' => array(
'header' => "Content-Type: application/json\r\n",
'method' => 'POST',
'content' => json_encode($data)
)
);
$context = stream_context_create($options);
$response = file_get_contents($url, false, $context);
if ($response === false) {
} else {
$response_data = json_decode($response, true);
......
}
这种回应似乎忽略了音调的价值.我既try 将其作为整数传递,也try 将其作为字符串传递,但结果不变. 我做错了什么?
谢谢.