<?php
/**
* 测试语音
*/
require '../common.inc.php';
require DT_ROOT.'/api/speech/AipSpeech.php';
$client = new AipSpeech(APP_ID, API_KEY, SECRET_KEY);
$result = $client->synthesis('您有一条财务审批,请注意查收!', 'zh', 1, array(
'vol' => 5,));
// 识别正确返回语音二进制 错误则返回json 参照下面错误码
if(!is_array($result)){
file_put_contents('audio.mp3', $result);
}
echo ' <embed src="audio.mp3" hidden="false" autostart="true" loop="true" width="0" height="0">';
?>
PHP生成语音
最新推荐文章于 2023-05-25 16:08:03 发布