解说社区

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 292|回复: 1

[原创] 语音库调节面板v1.7

[复制链接]
发表于 2023-8-15 14:07:08 来自手机 | 显示全部楼层 |阅读模式
点击上面的数字(以10%为一个选项),或者点击输入框自行输入。再点击设置项即可生效。点击点这个符号,会替换掉最后一位数字,方便语速加倍的数值输入。
作者:心灵亮光,qq:1433450662
v1.7
1.增加当编辑框为空,一件切换对应语音库
2.增加点符号,点击.后,会替换掉最后一位数字,方便语速加倍的数值输入。



  来自解说社区客户端
回复

使用道具 举报

 楼主| 发表于 2023-8-15 14:07:42 来自手机 | 显示全部楼层
require "import"
import "android.widget.*"
import "android.view.*"
layout=
{
LinearLayout,
orientation=1,
layout_width=-1,
layout_height=-1,
{
LinearLayout,
layout_width=-1,
layout_height=-1,
layout_weight=0,
{
TextView,
text="语音调节面板",
Gravity="center_horizontal",
textSize='50sp';
textColor='#ff0000';
layout_width=-1,
layout_height="10%h",
layout_weight=-1,
},
},
{
LinearLayout,
layout_width=-1,
layout_height=-1,
layout_weight=0,
{
EditText,
id="edit",
hint="请输入数字",
HintTextColor='#ff00ffff',
textColor="#ff00ffff",
textSize='40sp';
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},
},
{
LinearLayout,
layout_width=-1,
layout_height=-1,
layout_weight=1,
{
Button,
text="10",
onClick="sz",
textColor="#ffff00ff",
textSize='20sp';
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},
{
Button,
text="20",
onClick="sz",
textColor="#ffff00ff",
textSize='20sp';
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},
{
Button,
text="30",
onClick="sz",
textColor="#ffff00ff",
textSize='20sp';
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},
{
Button,
text="40",
onClick="sz",
textColor="#ffff00ff",
textSize='20sp';
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},
{
Button,
text="50",
onClick="sz",
textColor="#ffff00ff",
textSize='20sp';
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},
},
{
LinearLayout,
layout_width=-1,
layout_height=-1,
layout_weight=1,
{
Button,
text="60",
onClick="sz",
textColor="#ffff00ff",
textSize='20sp';
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},
{
Button,
text="70",
onClick="sz",
textColor="#ffff00ff",
textSize='20sp';
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},
{
Button,
text="80",
onClick="sz",
textColor="#ffff00ff",
textSize='20sp';
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},
{
Button,
text="90",
onClick="sz",
textColor="#ffff00ff",
textSize='20sp';
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},
{
Button,
text="100",
onClick="sz",
textColor="#ffff00ff",
textSize='20sp';
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},
{
Button,
text=".",
onClick="dian",
textColor="#ffff00ff",
textSize='20sp';
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},},
{LinearLayout,
orientation=0,
layout_width=-1,
layout_height=-1,
layout_weight=1,
{LinearLayout,
orientation=1,
layout_width=-1,
layout_height=-1,
layout_weight=1,
{
Button,
text="主语音音量,\n无输入则切换讯飞",
onClick="zyyyl",
textColor="#ff00ff00",
textSize='20sp';
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},
{
Button,
text="主语音语速,\n无输入则切换SmartVoice",
onClick="zyyys",
textColor="#ff00ff00",
textSize='20sp';
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},
{
Button,
text="主语音音调,\n无输入则切换讯飞语记",
onClick="zyyyd",
textColor="#ff00ff00",
textSize='20sp';
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},
{
Button,
text="主语音语速加倍,\n无输入则切换天坦语音",
onClick="zyyjb",
textColor="#ff00ff00",
textSize='20sp';
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},
{Button,
text="选择主语音库",
onClick="zyyyq",
textColor="#ff00ff00",
textSize='20sp';
layout_width=-1,
layout_height="10%h",
layout_weight=1,},
},
{
LinearLayout,
orientation=1,
layout_width=-1,
layout_height=-1,
layout_weight=1,
{
Button,
text="副语音音量,\n无输入则切换系统语音引擎",
onClick="fyyyl",
textColor="#ff0000ff",
textSize='20sp';
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},
{
Button,
text="副语音语速,\n无输入则切换multitts",
onClick="fyyys",
textColor="#ff0000ff",
textSize='20sp';
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},
{
Button,
text="副语音语调",
onClick="fyyyd",
textColor="#ff0000ff",
textSize='20sp';
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},
{
Button,
text="副语音语速加倍",
onClick="fyyjb",
textColor="#ff0000ff",
textSize='20sp';
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},
{Button,
text="选择副语音库",
onClick="fyyyq",
textColor="#ff0000ff",
textSize='20sp';
layout_width=-1,
layout_height="10%h",
layout_weight=1,},
},
},
}
dlg=LuaDialog()
.setView(loadlayout(layout))
.show()
function zyyyl()
dlg.hide()
if edit.text~=""
service.setTTSVolume(tonumber(edit.text))
service.asyncSpeak("音量"..edit.text)
else
service.click({{
"%选择语音库$100","讯飞"
}})
end
end
function zyyys()
dlg.hide()
if edit.text~=""
service.setTTSSpeed(tonumber(edit.text))
service.asyncSpeak("语速"..edit.text)
else
service.click({{
"%主语音库/tts.smartvoice"
}})
end
end
function zyyyd()
dlg.hide()
if edit.text~=""
service.setTtsPitch(tonumber(edit.text))
service.asyncSpeak("语调"..edit.text)
else
service.click({{
"%主语音库/com.iflytek.vflynote"
}})
end
end
function zyyjb()
dlg.hide()
if edit.text~=""
service.setTtsScale(tonumber(edit.text))
service.asyncSpeak("加倍"..edit.text)
else
service.click({{
"%主语音库/com.android.tback"
}})
end
end
function fyyyl()
dlg.hide()
if edit.text~=""
service.setAsyncTTSVolume(tonumber(edit.text))
service.asyncSpeak("音量"..edit.text)
else
service.click({{
"%主语音库/com.xiaomi.mibrain.speech"
}})
end
end
function fyyys()
dlg.hide()
if edit.text~=""
service.setAsyncTTSSpeed(tonumber(edit.text))
service.asyncSpeak("语速"..edit.text)
else
service.click({{
"%主语音库/org.nobody.multitts"
}})
end
end
function fyyyd()
dlg.hide()
service.setAsyncTtsPitch(tonumber(edit.text))
service.asyncSpeak("语调"..edit.text)
end
function fyyjb()
dlg.hide()
service.setAsyncTtsScale(tonumber(edit.text))
service.asyncSpeak("加倍"..edit.text)
end
function zyyyq()
dlg.hide()
service.setTtsEngine()
end
function fyyyq()
dlg.hide()
service.setAsyncTtsEngine()
end
function sz(v)
edit.text=edit.text..v.getText()
end
function dian(v)
edit.text=utf8.sub(edit.text,1,-2)..v.getText()
end



  来自解说社区客户端
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|解说社区

GMT+8, 2024-5-5 07:22 , Processed in 0.042250 second(s), 13 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表