三种方法在树莓派上实现文字转语音服务

方法1:Festival Text to Speech

1
2
3
4
sudo apt-get install festival
echo “Just what do you think you're doing, Dave?” | festival --tts
speak RPi’s IP address:
hostname -I | festival -tts

方法2:Espeak Text to Speech

1
2
sudo apt-get install espeak
espeak -ven+f3 -k5 -s150 "I've just picked up a fault in the AE35 unit"

方法3:Google Text to Speech

1
sudo nano /etc/mplayer/mplayer.conf

添加一行

1
nolirc=yes

创建 speech.sh 脚本

1
nano speech.sh

内容如下:

1
2
3
#!/bin/bash
say() { local IFS=+;/usr/bin/mplayer -ao alsa -really-quiet -noconsolecontrols "http://translate.google.com/translate_tts?tl=en&q=$*"; }
say $*

脚本授权,执行脚本。

1
2
chmod u+x speech.sh
./speech.sh Look Dave, I can see you're really upset about this.

参考连接:http://elinux.org/RPi_Text_to_Speech_(Speech_Synthesis)

本站原创文章,作者:小 编,如若转载,请注明出处:https://www.mzbky.com/1819.html

(1)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
小 编的头像小 编新注册
上一篇 2020年3月16日 下午8:47
下一篇 2020年3月16日 下午10:32

相关推荐

发表回复

登录后才能评论