18910140161

Anki mobie调用系统内置的tts实现朗读!不需要插件!Ios和windows都有!

顺晟科技

2021-09-13 10:31:21

414

如何在苹果anki上调用系统自带的tts?
怎么让苹果的anki(anki mobie)朗读?

问题背景

anki支持调用tts的,但是网络上有关知识流传的比较少,缤纷火条同学作为一个热心肠,觉得很有义务给大家说到说道。本文主要以ios的anki为对象,不添加音频,直接朗读!
效果也还不错,听起来比较自然。

awesome的tts虽然大家都在推荐,但是我实用后只能用有道实现我的目的,买个会员吧虽然说也不贵,但是感觉就不是很快乐,现在时间紧张,不能折腾音频文件了,况且ipad录音后同步可能会出现不知名的小问题,例如安卓设备莫名多了一个无法删除的牌组(anki droid)(2021.8月仍有)

集英俊与智慧于一身的缤纷火条,他常常会修改模版,然后常常使用anki的全同步,很耗费时间,媒体文件大更是一个噩梦,于是他本着节省空间的想法使用ios系统自带的tts来解决问题

使用场景

例如
我下载了一份单词书,分为三个部分,
(广告位招租:)

*单词
*解释
*助记

我让正面读出 单词和助记忆
反面读出答案部分,实现带着我思考,减少走神现象的发生,也可以歇歇眼睛,不必游走

该方法存在的不足

由于使用的方法是{{tts zh_TW:question(字段的名称)}}
导致了,在安卓设备上不支持读出(官方不支持,截止到21.9.8)
并且最让我不能忍受的是,他会让我的页面出现一个新的 重复的 字段

这肯定不行,于是俺作为刚刚入门css的小白
思考了一下,一个好的办法就出现了

给这个tts添加一个css控制,不让他显示

实现方法

在页面的行(正面)

<div class=tts> {{tts zh_TW:问题iii}} {{tts zh_TW:小标题}}</div>

css添加下面的内容



.tts {     
font-size: 0px;
padding: 0em 0em 0em 0em;
text-indent: 0em;
border : 0px solid;
position : relative;
margin : 0px ;
# text-decoration: none;
}

.replay-button svg {
   width: 0px;
   height: 0px;
 }
 .replay-button svg circle {
fill: blue; }
 .replay-button svg path {
   stroke: white;
   fill: green;
}

补充两句

——-
如果你想给你的小喇叭修改一下
你可以找到这些语句修改—-:


.replay-button svg {
   width: 0px;
   height: 0px;
 }
 .replay-button svg circle {
fill: blue; }
 .replay-button svg path {
   stroke: white;
   fill: green;
}

至此,成功实现朗读功能,如果你需要他重读,只需要按下键盘的R,就可以在ios(ankimobie上面重读)

20210912补充:

如何更换一个语音包呢?

在你的非安卓设备可以在卡牌的正面输入

{{tts-voices:}}

输入保存 预览,相信他会显示出很多的文字,我们复制下来

随后复制一个

{{tts zh-CN voices=Apple_Li-mu:Front}}
{{tts zh-CN voices=Apple_田田:Front}}
{{tts zh-CN voices=Apple_语舒:Front}}
{{tts zh-HK voices=Apple_善怡:Front}}
{{tts zh-TW voices=Apple_美嘉:Front}}

例如我选择:

{{tts zh-TW voices=Apple_美嘉(优化音质):Front}}

上面的front你可以修改成 你的字段的名称,例如:问题,答案等等

如何实现倍速播放呢?

你可以在冒号前面,加上speed=0.7 达到放慢语速的目的

于是你的apple设备可以正常播放了。

在安卓设备上发现 排版错误咋办

如果你发现,妈呀,我的这个电脑 安卓播放的时候 咋这样啊,多了一个小喇叭不说,整个排版全乱了

我使用的方法是,在css里面建立一个空白,
然后用把小喇叭的大小设置为0,然后把发音部分给放到div块里面


<div class=tts> {{tts en_US:问题iii}} 
{{tts zh-CN voices=Apple_Li-mu speed=1.25 :小标题}}</div>

附件:
如果需要多语言朗读,只读挖空等等内容,请阅读下面的


{{tts en_US:Front}}
On Windows, MacOS, and iOS, Anki will use the OS’s built in voices. On Linux, no voices are built in, but voices can be provided by add-ons, such as this one.
To see a list of all available languages/voices, place the following on your card template:
 {{tts-voices:}}
If there are multiple voices that support your chosen language, you can specify desired voices in a list, and Anki will choose the first available voice. For example:
 {{tts ja_JP voices=Apple_Otoya,Microsoft_Haruka:Field}}
This would use Otoya when on an Apple device, and Haruka when on a Windows PC. Specifying a different speed is possible in some TTS implementations:
 {{tts fr_FR speed=0.8:SomeField}}
Both speed and voices are optional, but the language must be included. On a Mac, you can customize the available voices:
Open the System Preferences screen.
Click on Accessibility.
Click on Speech.
Click on the system voice dropdown, and choose Customize.
Some voices sound better than others, so experiment to choose the one you prefer. Please note that the Siri voice can only be used by Apple apps. Once you’ve installed new voices, you’ll need to restart Anki for the new voices to become available.
On Windows, some voices like Cortana can not be selected, as Microsoft does not make those voices available to other applications.
On a cloze note type, you can make Anki read only the elided sections using the cloze-only filter, like so:
 {{tts en_US:cloze-only:Text}}
     The cloze-only filter is supported in Anki 2.1.29+ and AnkiMobile 2.0.65+.

如果,这片文章对你有帮助,请给缤纷火条一点支持,
可以是关注他的微信公众号,给他一个关注,一个阅读
也可以去他的网易云音乐听听他的原创歌曲,找找看有没有你喜欢的
认准「缤纷火条」不迷路

我们已经准备好了,你呢?
2024我们与您携手共赢,为您的企业形象保驾护航