startSpeaking static method
开始语音合成
volume :音量,范围(0100),默认50;
100),默认50;
speed :语速,范围(0pitch :语调,范围(0~100),默认50;
streamType :音频流类型,默认为null 只对Android生效;
playerInit :是否初始化音频播放器, 默认为 '1' 只对iOS生效
content :播放内容;
voiceName :发音人,默认"小燕".每个发音人有对应的性别,语种和方言。具体可参照demo中
的发音人列表。
Implementation
/*
* 云端支持如下发音人:
* 对于网络TTS的发音人角色,不同引擎类型支持的发音人不同,使用中请注意选择。
*
* |--------|----------------|
* | 发音人 | 参数 |
* |--------|----------------|
* | 小燕 | xiaoyan |
* |--------|----------------|
* | 小宇 | xiaoyu |
* |--------|----------------|
* | 凯瑟琳 | catherine |
* |--------|----------------|
* | 亨利 | henry |
* |--------|----------------|
* | 玛丽 | vimary |
* |--------|----------------|
* | 小研 | vixy |
* |--------|----------------|
* | 小琪 | vixq |
* |--------|----------------|
* | 小峰 | vixf |
* |--------|----------------|
* | 小梅 | vixl |
* |--------|----------------|
* | 小莉 | vixq |
* |--------|----------------|
* | 小蓉 | vixr |
* |--------|----------------|
* | 小芸 | vixyun |
* |--------|----------------|
* | 小坤 | vixk |
* |--------|----------------|
* | 小强 | vixqa |
* |--------|----------------|
* | 小莹 | vixyin |
* |--------|----------------|
* | 小新 | vixx |
* |--------|----------------|
* | 楠楠 | vinn |
* |--------|----------------|
* | 老孙 | vils |
* |--------|----------------|
*/
static Future<void> startSpeaking({
String? volume,
String? speed,
String? pitch,
String? voiceName,
String? streamType,
String? playerInit,
required String content,
}) async {
Map<String, dynamic> arguments = {
'volume': volume ?? '50',
'speed': speed ?? '50',
'pitch': pitch ?? '50',
'voiceName': voiceName ?? 'xiaoyan',
'content': content,
'streamType': streamType,
};
if (playerInit != null) {
arguments['playerInit'] = playerInit;
}
return await methodChannel.invokeMethod('start_speaking', arguments);
}