ios-senior23-Iflytek speech Recognition 2

Source: Internet
Author: User

Turn text into speech, steps and anything like, directly on the code

First step: Introduce the header file

callback method interface for text recognition

#import <iflyMSC/IFlySpeechSynthesizerDelegate.h>

Text Recognition Object

#import <iflyMSC/IFlySpeechSynthesizer.h>

//Iflytek definition constants for voice frames

#import <iflyMSC/IFlySpeechConstant.h>

Extend

@interface Secondviewcontroller () <IFlySpeechSynthesizerDelegate>

Display text (socket variable)

@property (Weak, nonatomic) Iboutlet Uitextview *inputcontenttextview;

Text Recognition Object

@property (Strong, nonatomic) Iflyspeechsynthesizer *synthesizer;

@end

@implementation Secondviewcontroller

-(void) Viewdidload {

[Super Viewdidload];

Do any additional setup after loading the view.

Create a text recognition object (Singleton method)

Self.synthesizer = [Iflyspeechsynthesizer sharedinstance];

Specify a proxy object for a text-aware object

Self.synthesizer.delegate = self;

Set key properties of a text-aware object

[Self.synthesizer setparameter:@ "forkey:[iflyspeechconstant speed] ];

[Self.synthesizer setparameter:@ "Forkey:[iflyspeechconstant VOLUME]];

[Self.synthesizer setparameter:@ "XIAOYAN" Forkey:[iflyspeechconstant voice_name]];

[Self.synthesizer setparameter:@ "8000" forkey:[iflyspeechconstant sample_rate]];

[Self.synthesizer setparameter:@ "TEMP.PCM" Forkey:[iflyspeechconstant Tts_audio_path]];

[Self.synthesizer setparameter:@ "Custom" Forkey:[iflyspeechconstant PARAMS]];

}

#pragma mark-Identify the relevant content

-(ibaction)beginrecongnise:(ID) Sender {

[Self.synthesizer startspeaking: _inputcontenttextview.text];

}

#pragma mark-Proxy method

-(void)oncompleted:(Iflyspeecherror *) Error {

NSLog (@ "Da");

}

@end

ios-senior23-Iflytek speech Recognition 2

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.