PHP code example of machero / speech
1. Go to this page and download the library: Download machero/speech library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
machero / speech example snippets
$speech = new AipSpeech(
config('baidu-speech.app_id'),
config('baidu-speech.app_key'),
config('baidu-speech.app_secret')
);
$this->speech = $speech;
/**
* @apiparams $text 要合成的文本
* @apiparams $spd 语音的速度
*
*/
$mp3 = $this->speech->synthesis($text, $lang='zh', $ctp=1, $options=array('spd'=>3));
//具体请参考百度智能语音开发文档