On the speech synthesis of Iflytek-fei-Xun open platform

Source: Internet
Author: User

1: The open platform provides a lot of services, voice-related: Offline, on-line speech synthesis and recognition, human-computer interaction, pattern recognition Related: Face recognition, voice recognition, as well as cloud storage and so on, if interested, self-Baidu.

650) this.width=650; "src=" http://s4.51cto.com/wyfs02/M02/7F/4A/wKiom1cYyYqjXGZ8AABn2pqkZs8729.jpg "title=" 1.JPG " alt= "Wkiom1cyyyqjxgz8aabn2pqkzs8729.jpg"/>

2: Look under the official SDK and try to experience it. Import two jar packages into the Lib directory, and two DLLs and so files to the project root directory.

This time first experience the speech synthesis module.

    • Speech synthesis mainly involves a class, such as the next, complete speech synthesis

Import com.iflytek.cloud.speech.speechconstant;import com.iflytek.cloud.speech.speecherror;import  com.iflytek.cloud.speech.SpeechSynthesizer;import com.iflytek.cloud.speech.SynthesizerListener; public class ttsspeech {//defines two member variables, one that needs to be synthesized, one is the output path of the voice file, but the voice file generated by the Iflytek cannot be played, possibly for other reasons. public string content;public string audiooutpath;//Constructor Public ttsspeech (String  Content, string audiooutpath)  {super ();this.content = content;this.audiooutpath  = audiooutpath;} /** *  Speech synthesis Function  */public void synthesize ()  {SpeechSynthesizer  Speechsynthesizer = speechsynthesizer.createsynthesizer ();//  Set pronunciation person speechsynthesizer.setparameter (speechconstant.voice_name,  "XiaoYan");//  set the speed, range 0~ 100speechsynthesizer.setparameter (speechconstant.speed,  ");//  set intonation, range 0~ 100speechsynthesizer.setparameter (speechconstant.pitch,  ");//  set volume, Range 0~100speechsyntHesizer.setparameter (speechconstant.volume,  ");//  set the composition audio save location (customizable save location), saved by default in"./IFLYTEK.PCM " Speechsynthesizer.setparameter (Speechconstant.tts_audio_path, this.audiooutpath); Speechsynthesizer.startspeaking (This.content, mysynlistener);} /** *  Synthetic Listener  */private static synthesizerlistener mysynlistener = new  synthesizerlistener ()  {@Overridepublic  void onbufferprogress (int arg0, int  ARG1, INT ARG2,STRING ARG3)  {// todo auto-generated method stub  //system.out.println ("Speech Synthesis Progress" +arg0+ "-" +arg1+ "-" +arg2+ "\ n");} @Overridepublic  void oncompleted (speecherror arg0)  {// TODO Auto-generated  Method stub system.out.println ("Voice conversion complete" + "\ n");  } @Overridepublic  void onspeakbegin ()  {// todo auto-generated method stub system.out.println ("Start voice conversion" + "\ n");} @Overridepublic  VOID ONSPEakpaused ()  {// todo auto-generated method stub} @Overridepublic  void  Onspeakprogress (INT ARG0, INT ARG1, INT ARG2)  {// todo auto-generated  METHOD STUB//SYSTEM.OUT.PRINTLN ("Voice playback Progress" +arg0+ "-" +arg1+ "-" +arg2+ "\ n");} @Overridepublic  void onspeakresumed ()  {// todo auto-generated method stub}} ;}
    • Here's how to call the class object to complete a specific content speech synthesis

String content= "I was at a crossroads in my life more than 20 years ago. As we spend 5 years building the end of the deltagraph for publishers, who want the emerging Internet space "; String path= "D:/test/test.wav"; Speechutility.createutility (speechconstant.appid+ "=5712115d"); System.out.println ("Content:" +content+ ":" +content.length ()); Ttsspeech tts=new Ttsspeech (Content,path); TTS. Synthesize ();

After executing the program, you will soon be able to hear the above text content of the voice playback, but also good.

This article is from the "Reminder Flower Rain" blog, please make sure to keep this source http://chenwen.blog.51cto.com/771416/1766410

On the speech synthesis of Iflytek-fei-Xun open platform

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.