Delphi calls Baidu speech recognition rest API

Source: Internet
Author: User

Delphi calls Baidu speech recognition rest API
-20160616
-Thanks to the Magic Cat and Delphiteacher Brother's help to solve the problem of returning Chinese garbled!
-Note: The Voice recording format currently only supports the evaluation of Mono voice with 8k/16k sampling rate of 16bit bit depth
Compression format support: PCM (uncompressed), WAV, opus, Speex, AMR, X-flac

var surl, SLan, cuid, apiKey, Secretkey, token, sr:string;
Response:tstringstream; Stream:tfilestream;
Begin
//
SR: = ";
SLan: = ' zh ';//en en//x-flac
IdHttp.Request.ContentType: = ' audio/amr;rate=8000 ';
CUiD: = ' 392681 ';
apikey:= ' vah45xsaevxluk5ruwum4r1y ';
Secretkey: = ' Ogecx9oibaovylcywk1iotce9bbwejas ';
The following token is valid for 1 months and needs to be HTTP://YUYIN.BAIDU.COM/ASR for free registration upon expiration.
Token: = ' 25.e1bd734e752b559f3c710cd5cfa9c8ff.315360000.1781361290.282335-392681 ';
Stream: = Tfilestream.create (' e:\test0.amr ', fmsharedenynone);
Stream.position: = 0;
sURL: = ' http://vop.baidu.com/server_api?lan= ' +slan+ ' &cuid=fireboxsoftsmartai&token= ' +token;
Response: = Tstringstream.create (' ', Tencoding.utf8);
Idhttp.post (sURL, stream, response);
ShowMessage (response. datastring);
End

Delphi calls Baidu speech recognition rest API

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.