PHP code example of guandeng / aipspeech

1. Go to this page and download the library: Download guandeng/aipspeech 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/ */

    

guandeng / aipspeech example snippets


php artisan vendor:publish --provider="Guandeng\Aipspeech\AipSpeechProvider"



    $app_id = config('aipspeech.app_id');
    $app_key = config('aipspeech.app_key');
    $secret_key = config('aipspeech.secret_key');
    $client = new AipSpeech($app_id, $app_key, $secret_key);
    $result = $client->synthesis('你好百度。', 'zh', 1, array(
        'vol' => 5,
    ));
// 识别正确返回语音二进制 错误则返回json 参照下面错误码
if(!is_array($result)){
    file_put_contents('audio.mp3', $result);
}