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