Online speech synthesis

Turn text messages into voice messages and give the app a “mouth”. We offer a wide range of distinctive speakers to choose from. Its synthetic sound in timbre, naturalness and other aspects of performance are close to or even more than the human voice. This speech synthesis experience meets the standard of being truly commercially viable

The voice synthesis of Iflytek is very good. There are not only basic pronunciation people, but also excellent pronunciation people, characteristic pronunciation people and star pronunciation people. Of course, if you have special requirements, you can also customize.

Here we choose the basic speaker to do a simple JavaWeb integration test, because other options still need to be applied, think about it and wait for the process to pass.

Platform environment

JDK1.7, Tomcat8, Eclipse, IFlyTEK JDK, Win + FFMPEG (test), Linux+Docker+ FFMPEG (production)

Tell the truth, Win platform ffMPEG installation is very easy to use, direct download compression package free installation, JAVA direct call execution command. Linux under a variety of dependent compilation can put your small machine run to death, and also a variety of compilation errors, and then decided to use Docker, the only headache is that the environment is really clean, various commands do not support, of course, this is also the advantage of Docker.

The flow chart

Web integration

Iflytek provides us with a simple SDK, IflyTEK MSC development guide -Java. Of course, the premise you have to have an IFly.com account, registration, create an application what here is not described, as long as the final can obtain an APP_ID can be.

Win + ffmpeg (test)

  • DLL or msc32.dll can be placed in the specified directory according to your System. You can use System.getProperty(“java.library.path “) to view it and place it in any directory.
  • Download the corresponding FFmpeg according to your own system, decompress it, and directly call ffmpeg.exe in the bin directory. –

The Linux + Docker + ffmpeg (production)

Get the FFMPEG image

docker pull jrottenberg/ffmpegCopy the code

Create and run the container

docker run -it --name app_ffmpeg -p 8080:8080 -v /home/app_ffmpeg/:/mnt/app/  --entrypoint='bash' jrottenberg/ffmpegCopy the code

Note: The various yum, wget, and VIm’s do not exist in the Docker container, so most of the configuration is retrieved from the host and copied to the container synchronously.

Installing and configuring the JDK

Oracle must be authenticated to download, here we download and manually upload to /home/app_ffmpeg directory.

# copy the configuration file to host machine docker cp f131c866092: / etc/profile/home/app_ffmpeg /Copy the code

Edit the profile and append the following configuration

#set JAVA_HOME=/ MNT /app/jdk1.7.0_80 JRE_HOME=/ MNT /app/jdk1.7.0_80/jre CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin export  JAVA_HOME JRE_HOME CLASS_PATH PATHCopy the code
Docker cp /home/app_ffmpeg-profile 4f131C866092: /etc/docker cp /home/app_ffmpeg-profile 4f131C866092 :/etcCopy the code

Enter the container and the configuration takes effect

Docker exec -it app_ffmpeg bash -Copy the code

Installing and configuring Tomcat

If Tomcat starts, the card master does not move

Find jdk1. 7.0.x.x _xx/jre/lib/security/Java security file, found in the file securerandom. Source this setting, it changed to:

securerandom.source=file:/dev/./urandomCopy the code

If Tomcat outputs Chinese garbled characters

Locale-locale-a LANG= c. utf-8 (zh_CN. Utf-8) source /etc/profileCopy the code

Configure the IFlytek dynamic library

Upload libmsc32.so or libmsc64.so to /lib/ and /lib64/ respectively, depending on your system version.

The open source project

Gitee.com/52itstyle/x…

Demo address

xunfei.52itstyle.com/xufei_msc/