Applescript:为每个单词使用新的(随机)语音说出 txt 文件中的单词
我需要制作一个脚本,从 txt 文件中选择一个随机句子,并使用一系列语音、语速调制和音调以随机语音说出每个单词。
例如: 从txt文件中随机选择一句话:“铺床:仔细听:看书” {"make", "a", "bed"} 是由随机声音逐字说出的:
say "make" using "Fred" speaking rate 43 modulation 40 pitch 11
say "a" using "Bruce" speaking rate 101 modulation 50 pitch 91
say "bed" using "Kathy" speaking rate 138 modulation 18 pitch 31
我可以使用一些建议,因为我是 AppleScript 的新手,感觉有点困难。 据我所知:
try
set myWordFile to (choose file with prompt "Select a file to read:" of type {"txt"})
open for access myWordFile
set wordContents to (read myWordFile)
close access myWordFile
set AppleScript's text item delimiters to ":"
set txtvar10 to words of wordContents
return txtvar10
end try
提前致谢:-)
I need to make an script that picks a random sentence from a txt-file and says each word in a random voice, using an array of voices, speaking rate modulation and pitch.
For example:
A sentence is chosen randomly from the txt file: "make a bed:listen carefully:read a book"
and {"make", "a", "bed"} is spoken word-for-word by a random voice:
say "make" using "Fred" speaking rate 43 modulation 40 pitch 11
say "a" using "Bruce" speaking rate 101 modulation 50 pitch 91
say "bed" using "Kathy" speaking rate 138 modulation 18 pitch 31
I could use some advice, as I'm new to AppleScript and feel a little stuck.
This is as far as I've gotten:
try
set myWordFile to (choose file with prompt "Select a file to read:" of type {"txt"})
open for access myWordFile
set wordContents to (read myWordFile)
close access myWordFile
set AppleScript's text item delimiters to ":"
set txtvar10 to words of wordContents
return txtvar10
end try
Thanks in advance :-)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
试试这个...
Try this...