2017 © Pedro Peláez
 

library laravel-baidu-speech

百度语音Api集成

image

jormin/laravel-baidu-speech

百度语音Api集成

  • Saturday, October 21, 2017
  • by jormin
  • Repository
  • 1 Watchers
  • 2 Stars
  • 59 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 59 % Grown

The README.md

集成了 百度AI 官方的Api接口。, (*1)

安装

  1. 安装包文件, (*2)

    bash $ composer require jormin/laravel-baidu-speech, (*3)

配置

  1. 注册 ServiceProvider:, (*4)

    Jormin\BaiduSpeech\BaiduSpeechServiceProvider::class,
    
  2. 创建配置文件:, (*5)

    php artisan vendor:publish
    

    执行命令后会在 config 目录下生成本扩展配置文件:laravel-baidu-speech.php。, (*6)

  3. .env 文件中增加如下配置:, (*7)

    • BAIDU_APP_ID:百度AppId。, (*8)

    • BAIDU_API_KEY:百度ApiKey。, (*9)

    • BAIDU_SECRET_KEY:百度SecretKey。, (*10)

使用

  1. 语音识别, (*11)

       Jormin\BaiduSpeech\BaiduSpeech::recognize($filePath, $url, $callback, $userID, $format, $rate, $lan);
    

    接口字段:, (*12)

    参数 类型 说明 可为空
    filePath String 语音文件本地路径,该字段和url字段二选一,优先使用此项 Y
    url String 语音文件URL路径,该字段和filePath字段二选一 Y
    callback String 回调地址 Y
    userID String 用户唯一标识 Y
    format String 语音文件格式,可选值 ['pcm', 'wav', 'opus', 'speex', 'amr'],默认为wav Y
    rate Integer 采样率,可选值 [8000, 16000],默认为16000 Y
    lan String 语言,可选值 ['zh', 'ct', 'en'],默认为zh Y

    接口返回字段详细见 百度官方文档., (*13)

  2. 语音合成, (*14)

       Jormin\BaiduSpeech\BaiduSpeech::combine($text, $userID, $lan, $speed, $pitch, $volume, $person, $filename);
    

    接口字段:, (*15)

    参数 类型 说明 可为空
    text String 合成的文本 N
    userID String 用户唯一标识 Y
    lan String 语言,可选值 ['zh'],默认为zh Y
    speed Integer 语速,取值0-9,默认为5中语速 Y
    pitch Integer 音调,取值0-9,默认为5中语调 Y
    volume Integer 音量,取值0-15,默认为5中音量 Y
    person Integer 发音人选择, 0为女声,1为男声,3为情感合成-度逍遥,4为情感合成-度丫丫,默认为普通女 Y
    fileName String 文件存储路径名称,默认存储在public/audios/目录下 Y

    接口返回字段详细见 百度官方文档., (*16)

License

The MIT License (MIT). Please see License File for more information., (*17)

The Versions

21/10 2017

dev-master

9999999-dev https://github.com/jormin/laravel-baidu-speech

百度语音Api集成

  Sources   Download

MIT

The Requires

 

The Development Requires

jormin 百度语音

21/10 2017

v1.0.2

1.0.2.0 https://github.com/jormin/laravel-baidu-speech

百度语音Api集成

  Sources   Download

MIT

The Requires

 

The Development Requires

jormin 百度语音

19/10 2017

v1.0.1

1.0.1.0 https://github.com/jormin/laravel-baidu-speech

百度语音Api集成

  Sources   Download

MIT

The Requires

 

The Development Requires

jormin 百度语音

16/10 2017

v1.0

1.0.0.0 https://github.com/jormin/laravel-baidu-speech

百度语音Api集成

  Sources   Download

MIT

The Requires

 

The Development Requires

jormin 百度语音