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
个赞
请登录后评论
TOP
切换版块
你好,当前测试版本sdk可能已过期,请测试最新版本 php demo ,可参考 https://github.com/Baidu-AIP/speech-demo