OS7 的这个功能确实不错。我刚试了下,用官方提供的API ,简单的几句代码就能实现文本转语音!

Xcode 5.0

工程建好后首先把AVFoundation.framework 加入到工程

 AVSpeechSynthesizer *av = [[AVSpeechSynthesizer alloc]init];
AVSpeechUtterance *utterance = [[AVSpeechUtterance alloc]initWithString:@"Hello qingjoin"]; //需要转换的文本
[av speakUtterance:utterance];
//以上三行代码就可以搞定文本转语音 有API就是省事。哈哈
/*******************************************************/
//具体可参考以下demo 记得.h文件里别忘记了这个哦
#import <AVFoundation/AVSpeechSynthesis.h> //
// ViewController.m
// AVideoSpeechDemo
//
// Created by qingyun on 6/28/13.
// Copyright (c) 2013 qingyun. All rights reserved.
//
#import "ViewController.h" @interface ViewController () @end @implementation ViewController - (void)viewDidLoad
{
[super viewDidLoad];
_textS.delegate = self;
// Do any additional setup after loading the view, typically from a nib.
} - (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
} - (IBAction)textToSpeechBtnPress:(id)sender
{
AVSpeechSynthesizer *av = [[AVSpeechSynthesizer alloc]init];
AVSpeechUtterance *utterance = [[AVSpeechUtterance alloc]initWithString:_textS.text]; //需要转换的文本
[av speakUtterance:utterance];
} -(BOOL)textFieldShouldReturn:(UITextField *)textField
{
[textField resignFirstResponder];
return YES;
} @end

2013-06-28 14:54:07.817 AVideoSpeechDemo[5468:60b] Enqueue: <AXSpeechAction: 0x166d9820> hello :Pitch 1.000000 : Language: (null)

2013-06-28 14:54:22.791 AVideoSpeechDemo[5468:60b] Enqueue: <AXSpeechAction: 0x166f94f0> hello, qingjoin :Pitch 1.000000 : Language: (null)

2013-06-28 15:06:42.424 AVideoSpeechDemo[5468:60b] Enqueue: <AXSpeechAction: 0x166f3af0> 你好,我是qingjoin ! hello :Pitch 1.000000 : Language: (null)

demo 下载连接:http://files.cnblogs.com/qingjoin/AVideoSpeechDemo.zip

iOS7 文本转语音 AVSpeechSynthesizer的更多相关文章

  1. iOS7 文本转语音 AVSpeechSynthesizer -转载-

    http://www.cnblogs.com/qingjoin/p/3160945.html iOS7 的这个功能确实不错.我刚试了下,用官方提供的API ,简单的几句代码就能实现文本转语音! Xco ...

  2. iOS 文本转语音(TTS)详解:Swift

    上一篇博客讲解了iOS的speech FrameWork语音识别的功能:http://www.cnblogs.com/qian-gu-ling/p/6599670.html,对应的这篇博客就写一下文本 ...

  3. c#文本转语音以及语音阅读小实例

    c#实现语音阅读以及文本转语音文件是基于c#的一个类库(SpeechSynthesizer )实现的,使用该类必须要添加引用using System.Speech.Synthesis;直接是无法添加引 ...

  4. 用TTS实现文本转语音

    最近被toefl单词虐成狗::>_<:: 想做一个可以自动把单词转成语音的软件,这样就可以在路上戴耳机边走边听啦~ 用微软的TTS语音库可以很容易地实现.早期的TTS要想实现中英文混合朗读 ...

  5. 在线教学、视频会议 Webus Fox(1)文本、语音、视频聊天及电子白板基本用法

    Webus Fox是基于网页的在线教学.视频会议软件,不用安装,直接使用.它提供文本.语音.视频聊天,文件共享.电子白板等功能. 1. 登录 访问 http://flash.webus.cn/#,用自 ...

  6. 个人开源作品,即时通讯App支持文本、语音、图片聊天

    开源一个即时通讯类App,支持纯文本.语音.地理位置.图片聊天,同时还加入了好友圈功能,支持分享动态和发送图片,支持搜索附近的人,使用的百度地图定位功能:由Bmob后端云提供服务器支持,欢迎喜欢的伙伴 ...

  7. unity3dWeb版文本转语音

    文本转语音 <script type="text/javascript"> function VioceSpeack(str) { var zhText = str; ...

  8. Python 文本转语音

    文本转语音,一般会用在无障碍开发.下面介绍如何使用Python实现将文本文件转换成语音输出. 准备 使用Speech API 原理 示例代码 小总结 pyttsx方式 原理 示例代码 小总结 pytt ...

  9. py库:文本转为语音(pywin32、pyttsx)

    http://blog.csdn.net/marksinoberg/article/details/52137547 Python 文本转语音 文本转为语音(使用Speech API) 需要安装 py ...

随机推荐

  1. 把HTML5网页封装成APP,APK的方法

     phonegap appcan HBuilder的native.js     推荐你用两个东西打包 一个是ionic,一个是hbuilder,Maven,apicloud   http://mobi ...

  2. CPU 球迷助威清理灰尘图形的全过程

    主机因为使用时间长的电源风扇,风扇轴承石油枯竭,导致拒绝或不转的风扇转速,热量使电源不能得到有效排除,往往会造成电脑死机,有几种方法来解决. 单省钱的办法例如以下: 1.把电源从主机上拆下,例如以下图 ...

  3. Mysql 和Oracle rows 区别

    mysql> explain select t1.* from t2 ,t1 where t2.id=t1.id and t2.id<3;\ +----+-------------+--- ...

  4. 让动态创建的ActiveX控件响应Windows消息

    当我们通过 CWnd::CreateControl() 动态创建 ActiveX   控件时, Windows 消息并不会被发送给我 们的由   CWnd 派生得控件类.例如,即使我们为 WM_KIL ...

  5. STL内存管理器的分配策略

    STL提供了很多泛型容器,如vector,list和map.程序员在使用这些容器时只需关心何时往容器内塞对象,而不用关心如何管理内存,需要用多少内存,这些STL容器极大地方便了C++程序的编写.例如可 ...

  6. [Android学习笔记]LayoutParams的使用

    LayoutParams的使用: 什么时候会用到此对象?动态布局,动态向ViewGroup中添加子view时,为子view设置此对象,目的是告诉父容器以何种方式呈现此子view LayoutParam ...

  7. 14.3.3 Locks Set by Different SQL Statements in InnoDB 不同的SQL语句在InnoDB里的锁设置

    14.3.3 Locks Set by Different SQL Statements in InnoDB 不同的SQL语句在InnoDB里的锁设置 locking read, 一个UPDATE,或 ...

  8. AWS(0) - Amazon Web Services

    Computer EC2 – Virtual Servers in the Cloud EC2 Container Service – Run and Manage Docker Containers ...

  9. discuz清空session,导致session保存机制失败,session无法更新与解决

    <?php function userErrorHandler() { $e = func_get_args(); echo '<pre style="color:red;&qu ...

  10. poj 2411 Mondriaan's Dream dp

    一个比较简单的状压dp,记录下每个点的状态即可. #include <iostream> #include <cstdio> #include <cstring> ...