[Use of Ios]ios TTS

Source: Internet
Author: User

Reference: http://www.tekuba.net/program/327/

Http://blog.sina.com.cn/s/blog_923fdd9b0101flx3.html

The iOS platform does not natively support TTS, so if developers want to make their app TTS, first find a good TTS library.
As you know from the cool bar, there are a few options on the iOS platform:
1,Openears and Flitetts
It's easy to retrieve these two libraries under Google: Openears and Flitetts. Openears is an open source iOS library that supports offline speech recognition and TTS, but it is mainly for English. The Flitetts is smaller and does not support Chinese. If you do Chinese speech synthesis, these two libraries are not used at all (the network of widely said, cool bar is not verified).


2,Google's online voice synthesis service
Another option is Google's online speech synthesis service, which is requested in the following format:
Http://translate.google.com/translate_tts?tl=en&q=tekuba
The following example returns the MP3 of the English pronunciation file for "Tekuba". If you need a Chinese pronunciation, you can modify the TL parameter to zh, the following example:
http://translate.google.com/translate_tts?tl=zh&q= Cool Bar
If you need a fixed voice broadcast in the app, using Google's online service is a good choice, just one request, save the returned mp3 locally, and read the local MP3 directly later. But most of the scenes are not fixed to the text that needs to be converted to speech, we can only choose another way.

3, Iflytek voice and Baidu voice
At present, the Chinese phonetic synthesis is a good thing is the hkust, at the speed, pause on the effect are good. But it offers an iOS version of the SDK that only supports online speech synthesis (similar to Google's online compositing service above) and does not currently support local offline compositing. The cool bar consulted with the technical staff of Iflytek, who said that the iOS version SDK, which supports offline speech synthesis, would probably be released in the middle of the year (it was 2014 when it was written in the cool bar).
In addition, Baidu also developed a voice technology platform in October 2013, but now use still need to apply, cool bar did not try, do not know whether it supports offline speech synthesis of iOS, if any students used, can also share under.

4,new features such as Avspeechsynthesizer provided by IOS7
If your app only supports IOS7 systems, then the new features introduced in this iOS7 for avfoundation.framework must be good for you.
Import #import <avfoundation/avspeechsynthesis.h> when used, as shown in the following example:
Avspeechsynthesizer *av = [[Avspeechsynthesizer alloc]init];
Avspeechutterance *utterance = [[avspeechutterance alloc]initwithstring:@ "Cool Bar"]; Text that needs to be converted
[AV speakutterance:utterance];
However, according to the cool bar test, the iOS7 provided by this interface synthesized voice more blunt and no pauses.

I need to use the text to speech function in my own small project, which is to read the text in the voice. First want to use the voice of the cloud, but each pronunciation requires and news to fly the server communication to obtain audio. Surfing the internet when found iOS7 new added this feature, do not need networking, speech synthesis function on the phone to complete, so in the absence of WiFi and traffic can also be used, take a trial, official documents in this: Apple official documents.

The use is very simple, the code is just a few lines:

[OBJC]View Plaincopy
    1. Avspeechutterance *utterance = [avspeechutterance
    2. speechutterancewithstring:@ "Hello World";
    3. Avspeechsynthesizer *synth = [[Avspeechsynthesizer alloc] init];
    4. [Synth speakutterance:utterance];


Executing the above code, the iOS device reads out the NSString object used to initialize the Avspeechutterance object, and the above code reads "Hello World".

Avspeechutterance objects have properties that set the effect of making sounds:


You can modify the speed, volume, and so on.

I found that reading an English word effect is also possible when I test, but when I read a lot of English sentences, the last word has not finished, the next word has already begun to read. Additional settings may also be required.

The effect of reading Chinese is very good, is the pronunciation of Putonghua, can read a long sentence, I tried to read a news, the effect is good.

[Use of Ios]ios TTS

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.