1,首先打开百度语音识别官网,注册一个账户成为开发者,接着创建一个应用,下载百度提供源代码 。
下载地址: http://yuyin.baidu.com/sdk/
官方文档地址:http://yuyin.baidu.com/docs/asr/54
2,打开源代码,进行配置参数或修改要识别的语言文件
demo1
<?php
define('AUDIO_FILE', "./text2audio_1.wav"); //语音文件地址,值支持本地
$url = "http://vop.baidu.com/server_api";
//put your params here
$cuid = "";
$apiKey = "";
$secretKey = "";
$auth_url = "https://openapi.baidu.com/oauth/2.0/token?grant_type=client_credentials&client_id=".$apiKey."&client_secret=".$secretKey;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $auth_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
$response =