Import
"zm.luae"
Import
"Cjson.lua"
Dim
朗读文本=
"我是紫猫学院的学员,编号:1027.本人QQ:822641801.本人承接Post等"
Call
朗读(朗读文本, 15000, 4, 5, 5, 4)
Sub
朗读(txt,sd,spd,pit,vol,per)
Dim
Path,Urls,talbeV,cuid,PostData,Url1,Htmltxt
Path =
"/sdcard/Pictures/Read.mp3"
Dim
arr=
array
(spd,pit,vol,per)
For
Each
s
In
Arr
If
s < 0
or
s > 9
Then
TracePrint
s,
"参数有超出范围"
Next
Urls=
"http://openapi.baidu.com/oauth/2.0/token?grant_type=client_credentials&client_id=OEAG26OXULG3g3kHr9we3IFa&client_secret=G9hCptqBbNj0LgqSkbNZVFfsVKHRbn3y"
Htmltxt=
Url.
get
(Urls,
"gbk"
)
If
CBool
(
InStr
(1, Htmltxt,
"{"
))
Then
talbeV =
Encode.
JsonToTable
(Htmltxt)
If
talbeV <>
""
Then
cuid=
zm.
RndStr(10, 2)
PostData =
"tex="
&
zm.
EncodeURL( txt )&
"&lan=zh&cuid="
& cuid &
"&ctp=1&spd="
&spd&
"&&pit="
&pit&
"&per="
&per&
"&vol="
&vol&
"&tok="
& talbeV[
"access_token"
]
Url1=
"http://tsn.baidu.com/text2audio?"
zm.
HttpDownload Url1 & PostData, Path
PlaySound
Path
Delay
sd
StopPlay
Dir.
Delete
( Path)
End
If
End
If
End
Sub