PHP语音合成不成功
a678140 发布于2020-12 浏览:1074 回复:1
0
收藏

require_once 'AipSpeech.php';

// 你的 APPID AK SK
const APP_ID = '23***065';
const API_KEY = 'RXtjT****eqhM';
const SECRET_KEY = 'g8p7*****x3';

$client = new AipSpeech(APP_ID, API_KEY, SECRET_KEY);
$ttt="你好百度23333";
$result = $client->synthesis('你好百度2333', 'zh', 1, array('vol' => 5,));

echo "结果为 $result
";

 

// 识别正确返回语音二进制 错误则返回json 参照下面错误码
if(!is_array($result))
{
file_put_contents('audio.mp3', $result);
}
else
{
echo "没有结果为 $ttt
";
}

?>

 

执行出来的结果是

结果为 Array
没有结果为 你好百度

 

什么地方出问题啊

收藏
点赞
0
个赞
共1条回复 最后由qq928243596回复于2022-09
#2用户已被禁言回复于2020-12

你好,当前测试版本sdk可能已过期,请测试最新版本 php demo ,可参考 https://github.com/Baidu-AIP/speech-demo

0
TOP
切换版块