Unity语音识别和语音合成 IOS

公司里提出一个需求,需要接讯飞的语音识别和语音合成SDK 。对于Android还好网上有很多的例子。对照着接SDK就好。但是IOS的网上的例子不是太多,尤其是对于小晴这种不会儿玩Xcode的unity程序员来说,更是难上加难。还好我看到阿黄的一片文章http://lib.csdn.net/article/unity3d/58020?knid=1283,这才看到了希望。看到这篇文章学会了接语音识别的SDK。然后照葫芦画瓢把语音合成的也接上了。

语音识别的就不多说了,按照阿黄的写就可以,可能会出现一个小问题就是,内容显示一下就没了。其实这个好解决 ,在Unity那边判断一下不为空的情况下把内容记录下来就OK了。
我还是把代码贴出来吧!


//
//  ViewController.h
//  Test4
//
//  Created by Xiyue Game on 17/8/21.
//  Copyright © 2017年 Xiyue Game. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "iflyMSC/IFlyMSC.h"
#import "Reachability.h"
#import "iflyMSC/IFlySpeechSynthesizerDelegate.h"
//引入语音合成类
@class IFlySpeechSynthesizer;
@class IFlyDataUploader;

@interface ViewController : UIViewController<IFlySpeechRecognizerDelegate,IFlySpeechSynthesizerDelegate,IFlyRecognizerViewDelegate,UIActionSheetDelegate>
@property (nonatomic, strong) IFlySpeechRecognizer *iFlySpeechRecognizer;//不带界面的识别对象
@property (nonatomic, strong) NSString * result;
@property (nonatomic, assign) BOOL isCanceled;
//声明语音合成的对象
@property (nonatomic, strong) IFlySpeechSynthesizer *iFlySpeechSynthesizer;

+ (ViewController*) instance;
-(void) isConnectionAvailable;//判断是否有网络
void _startup(void);

@end






//
//  ViewController.m
//  Test4
//
//  Created by Xiyue Game on 17/8/21.
//  Copyright © 2017年 Xiyue Game. All rights reserved.
//

#import "ViewController.h"
#import "iflyMSC/IFlyMSC.h"


@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // 在加载视图后,通常从笔尖进行任何其他设置。
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    //处理可以重新创建的任何资源。
}

static ViewController* gameMgr=nil;

- (id)init
{
    self = [super init];
    if (self) {
        // Initialization code here.
    }
    
    return self;
}

+ (ViewController*) instance
{
    if (gameMgr==nil)
    {
        gameMgr=[[ViewController alloc]init];
    }
    
    return gameMgr;
}

-(void)initRecognizer
{
    NSLog(@"%s",__func__);
    

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值