forked from flyher/shumeipai
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRPi Text to Speech (Speech Synthesis).html
115 lines (114 loc) · 37.9 KB
/
RPi Text to Speech (Speech Synthesis).html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><meta name="exporter-version" content=mNote Mac 2.4.10"/><meta name="created" content="2013-07-29T14:39:36Z"/><meta name="updated" content="2013-07-29T14:39:36Z"/><title>RPi Text to Speech (Speech Synthesis)</title></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div><div lang="en" dir="ltr" style="display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 19.1875px; font-family: sans-serif; height: 2333.453125px; padding: 0px; text-decoration: initial; width: 1127px;"><p style="display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 19.1875px; font-family: sans-serif; height: 19px; margin: 5.119999885559082px 0px 6.400000095367432px; padding: 0px; text-decoration: initial; width: 1127px;">This guide shows you three easy methods of getting your Raspberry Pi to talk, and describes the pros and cons of each.
</p>
<table style="background-image: none; background-attachment: scroll; background-origin: padding-box; background-clip: border-box; background-color: rgb(249, 249, 249); background-size: auto; border: 1px solid rgb(170, 170, 170); display: table; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 19.1875px; font-family: sans-serif; height: 146px; margin: 0px; padding: 5px; text-decoration: initial; width: 165px; background-position: 0% 0%; background-repeat: repeat repeat;"><tbody style="border: 0px none rgb(170, 170, 170); display: table-row-group; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 19.1875px; font-family: sans-serif; height: 146px; margin: 0px; padding: 0px; text-decoration: initial; vertical-align: middle; width: 165px;"><tr style="border: 0px none rgb(170, 170, 170); display: table-row; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 19.1875px; font-family: sans-serif; height: 142px; margin: 0px; padding: 0px; text-decoration: initial; vertical-align: middle; width: 165px;"><td style="display: table-cell; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 19.1875px; font-family: sans-serif; height: 140.296875px; margin: 0px; padding: 1px; text-decoration: initial; vertical-align: middle; width: 159px;"><div style="display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 19.1875px; font-family: sans-serif; height: 19px; margin: 0px; padding: 0px; text-align: center; text-decoration: initial; width: 159px;"><h2 style="display: inline; font-style: normal; font-variant: normal; font-weight: bold; font-size: 12px; line-height: 19.1875px; font-family: sans-serif; margin: 0px 0px 7.296000003814697px; overflow: hidden; padding: 0px; text-align: center; text-decoration: initial;">Contents</h2><span style="display: inline; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 19.1875px; font-family: sans-serif; margin: 0px; padding: 0px; text-align: center; text-decoration: initial;"> [<a href="http://elinux.org/RPi_Text_to_Speech_(Speech_Synthesis)#" style="border: 0px none rgb(6, 69, 173); color: rgb(6, 69, 173); display: inline; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 19.1875px; font-family: sans-serif; margin: 0px; outline: rgb(6, 69, 173) none 0px; padding: 0px; text-align: center; text-decoration: initial;">hide</a>] </span></div>
<ul style="display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 18.234375px; font-family: sans-serif; height: 114.015625px; margin: 3.6480000019073486px 0px; padding: 0px; text-align: left; text-decoration: initial; width: 159px; list-style: none outside none;">
<li style="display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 18.234375px; font-family: sans-serif; height: 18px; margin: 0px 0px 1.215999960899353px; padding: 0px; text-align: left; text-decoration: initial; width: 159px; list-style: none outside none;"><a href="http://elinux.org/RPi_Text_to_Speech_(Speech_Synthesis)#Why_use_Text_to_Speech.3F" style="border: 0px none rgb(6, 69, 173); color: rgb(6, 69, 173); display: inline; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 18.234375px; font-family: sans-serif; margin: 0px; outline: rgb(6, 69, 173) none 0px; padding: 0px; text-align: left; text-decoration: initial;"><span style="border: 0px none rgb(6, 69, 173); color: rgb(6, 69, 173); display: inline; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 18.234375px; font-family: sans-serif; margin: 0px; outline: rgb(6, 69, 173) none 0px; padding: 0px; text-align: left; text-decoration: initial;">1</span> <span style="border: 0px none rgb(6, 69, 173); color: rgb(6, 69, 173); display: inline; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 18.234375px; font-family: sans-serif; margin: 0px; outline: rgb(6, 69, 173) none 0px; padding: 0px; text-align: left; text-decoration: initial;">Why use Text to Speech?</span></a></li>
<li style="display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 18.234375px; font-family: sans-serif; height: 18px; margin: 0px 0px 1.215999960899353px; padding: 0px; text-align: left; text-decoration: initial; width: 159px; list-style: none outside none;"><a href="http://elinux.org/RPi_Text_to_Speech_(Speech_Synthesis)#Install_supporting_packages" style="border: 0px none rgb(6, 69, 173); color: rgb(6, 69, 173); display: inline; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 18.234375px; font-family: sans-serif; margin: 0px; outline: rgb(6, 69, 173) none 0px; padding: 0px; text-align: left; text-decoration: initial;"><span style="border: 0px none rgb(6, 69, 173); color: rgb(6, 69, 173); display: inline; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 18.234375px; font-family: sans-serif; margin: 0px; outline: rgb(6, 69, 173) none 0px; padding: 0px; text-align: left; text-decoration: initial;">2</span> <span style="border: 0px none rgb(6, 69, 173); color: rgb(6, 69, 173); display: inline; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 18.234375px; font-family: sans-serif; margin: 0px; outline: rgb(6, 69, 173) none 0px; padding: 0px; text-align: left; text-decoration: initial;">Install supporting packages</span></a></li>
<li style="display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 18.234375px; font-family: sans-serif; height: 18px; margin: 0px 0px 1.215999960899353px; padding: 0px; text-align: left; text-decoration: initial; width: 159px; list-style: none outside none;"><a href="http://elinux.org/RPi_Text_to_Speech_(Speech_Synthesis)#Festival_Text_to_Speech" style="border: 0px none rgb(6, 69, 173); color: rgb(6, 69, 173); display: inline; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 18.234375px; font-family: sans-serif; margin: 0px; outline: rgb(6, 69, 173) none 0px; padding: 0px; text-align: left; text-decoration: initial;"><span style="border: 0px none rgb(6, 69, 173); color: rgb(6, 69, 173); display: inline; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 18.234375px; font-family: sans-serif; margin: 0px; outline: rgb(6, 69, 173) none 0px; padding: 0px; text-align: left; text-decoration: initial;">3</span> <span style="border: 0px none rgb(6, 69, 173); color: rgb(6, 69, 173); display: inline; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 18.234375px; font-family: sans-serif; margin: 0px; outline: rgb(6, 69, 173) none 0px; padding: 0px; text-align: left; text-decoration: initial;">Festival Text to Speech</span></a></li>
<li style="display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 18.234375px; font-family: sans-serif; height: 18px; margin: 0px 0px 1.215999960899353px; padding: 0px; text-align: left; text-decoration: initial; width: 159px; list-style: none outside none;"><a href="http://elinux.org/RPi_Text_to_Speech_(Speech_Synthesis)#Espeak_Text_to_Speech" style="border: 0px none rgb(6, 69, 173); color: rgb(6, 69, 173); display: inline; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 18.234375px; font-family: sans-serif; margin: 0px; outline: rgb(6, 69, 173) none 0px; padding: 0px; text-align: left; text-decoration: initial;"><span style="border: 0px none rgb(6, 69, 173); color: rgb(6, 69, 173); display: inline; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 18.234375px; font-family: sans-serif; margin: 0px; outline: rgb(6, 69, 173) none 0px; padding: 0px; text-align: left; text-decoration: initial;">4</span> <span style="border: 0px none rgb(6, 69, 173); color: rgb(6, 69, 173); display: inline; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 18.234375px; font-family: sans-serif; margin: 0px; outline: rgb(6, 69, 173) none 0px; padding: 0px; text-align: left; text-decoration: initial;">Espeak Text to Speech</span></a></li>
<li style="display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 18.234375px; font-family: sans-serif; height: 18px; margin: 0px 0px 1.215999960899353px; padding: 0px; text-align: left; text-decoration: initial; width: 159px; list-style: none outside none;"><a href="http://elinux.org/RPi_Text_to_Speech_(Speech_Synthesis)#Google_Text_to_Speech" style="border: 0px none rgb(6, 69, 173); color: rgb(6, 69, 173); display: inline; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 18.234375px; font-family: sans-serif; margin: 0px; outline: rgb(6, 69, 173) none 0px; padding: 0px; text-align: left; text-decoration: initial;"><span style="border: 0px none rgb(6, 69, 173); color: rgb(6, 69, 173); display: inline; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 18.234375px; font-family: sans-serif; margin: 0px; outline: rgb(6, 69, 173) none 0px; padding: 0px; text-align: left; text-decoration: initial;">5</span> <span style="border: 0px none rgb(6, 69, 173); color: rgb(6, 69, 173); display: inline; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 18.234375px; font-family: sans-serif; margin: 0px; outline: rgb(6, 69, 173) none 0px; padding: 0px; text-align: left; text-decoration: initial;">Google Text to Speech</span></a></li>
<li style="display: list-item; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 18.234375px; font-family: sans-serif; height: 18px; margin: 0px 0px 1.215999960899353px; padding: 0px; text-align: left; text-decoration: initial; width: 159px; list-style: none outside none;"><a href="http://elinux.org/RPi_Text_to_Speech_(Speech_Synthesis)#Recommendations" style="border: 0px none rgb(6, 69, 173); color: rgb(6, 69, 173); display: inline; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 18.234375px; font-family: sans-serif; margin: 0px; outline: rgb(6, 69, 173) none 0px; padding: 0px; text-align: left; text-decoration: initial;"><span style="border: 0px none rgb(6, 69, 173); color: rgb(6, 69, 173); display: inline; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 18.234375px; font-family: sans-serif; margin: 0px; outline: rgb(6, 69, 173) none 0px; padding: 0px; text-align: left; text-decoration: initial;">6</span> <span style="border: 0px none rgb(6, 69, 173); color: rgb(6, 69, 173); display: inline; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 18.234375px; font-family: sans-serif; margin: 0px; outline: rgb(6, 69, 173) none 0px; padding: 0px; text-align: left; text-decoration: initial;">Recommendations</span></a></li>
</ul>
</td></tr></tbody></table>
<h2 style="display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 19px; line-height: 19.1875px; font-family: sans-serif; height: 19px; margin: 0px 0px 11.520000457763672px; overflow: hidden; padding: 9.59375px 0px 3.25px; text-decoration: initial; width: 1127px;"> <span style="display: inline; font-style: normal; font-variant: normal; font-weight: normal; font-size: 19px; line-height: 19.1875px; font-family: sans-serif; margin: 0px; padding: 0px; text-decoration: initial;"> Why use Text to Speech? </span></h2>
<p style="display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 19.1875px; font-family: sans-serif; height: 38px; margin: 5.119999885559082px 0px 6.400000095367432px; padding: 0px; text-decoration: initial; width: 1127px;">It’s very easy add to your program - just output a string to the speech function instead of the screen.
You don’t need an expensive/complicated LCD or monitor for your project - just use any old mp3 player loudspeaker or PC loudspeaker which you have probably got lying around - or even an earphone works well for debugging purposes too.
</p><p style="display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 19.1875px; font-family: sans-serif; height: 38px; margin: 5.119999885559082px 0px 6.400000095367432px; padding: 0px; text-decoration: initial; width: 1127px;">You could use speech output for:
(i) status messages - e.g. internet connection made or IP address on a headless RPi;
(ii) user interface - e.g. speak the mode selected or station name with button presses on an RPi internet radio;
(iii) main functionality - e.g. tell the time and read the weather forecast on your RPi alarm clock.
</p>
<h2 style="display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 19px; line-height: 19.1875px; font-family: sans-serif; height: 19px; margin: 0px 0px 11.520000457763672px; overflow: hidden; padding: 9.59375px 0px 3.25px; text-decoration: initial; width: 1127px;"> <span style="display: inline; font-style: normal; font-variant: normal; font-weight: normal; font-size: 19px; line-height: 19.1875px; font-family: sans-serif; margin: 0px; padding: 0px; text-decoration: initial;"> Install supporting packages </span></h2>
<p style="display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 19.1875px; font-family: sans-serif; height: 38px; margin: 5.119999885559082px 0px 6.400000095367432px; padding: 0px; text-decoration: initial; width: 1127px;">Speech output requires a few audio software packages to be installed on your RPi. They may be already there but it does no harm to try to install these listed below anyway. The installer will let you know if the package is already present on your RPi. The instructions below are based on the Raspbian distribution (August 2012).
</p><p style="display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 19.1875px; font-family: sans-serif; height: 38px; margin: 5.119999885559082px 0px 6.400000095367432px; padding: 0px; text-decoration: initial; width: 1127px;">Firstly I recommend updating your Raspbian distribution if you have not recently already done so. Speech did not work for me until I did this. This may take 30 - 60 minutes depending on your connection speed etc. To do this:
</p>
<pre style="background-image: none; background-attachment: scroll; background-origin: padding-box; background-clip: border-box; background-color: rgb(249, 249, 249); background-size: auto; border: 1px dashed rgb(47, 111, 171); display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 16.625px; font-family: monospace, Courier; height: 32px; margin: 12.800000190734863px 0px; padding: 12.796875px; text-decoration: initial; white-space: pre; width: 1099.40625px; background-position: 0% 0%; background-repeat: repeat repeat;">sudo apt-get update
sudo apt-get upgrade
</pre>
<p style="display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 19.1875px; font-family: sans-serif; height: 19px; margin: 5.119999885559082px 0px 6.400000095367432px; padding: 0px; text-decoration: initial; width: 1127px;">If you do not already have sound on your RPi then you will need the alsa sound utilities:
</p>
<pre style="background-image: none; background-attachment: scroll; background-origin: padding-box; background-clip: border-box; background-color: rgb(249, 249, 249); background-size: auto; border: 1px dashed rgb(47, 111, 171); display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 16.625px; font-family: monospace, Courier; height: 16px; margin: 12.800000190734863px 0px; padding: 12.796875px; text-decoration: initial; white-space: pre; width: 1099.40625px; background-position: 0% 0%; background-repeat: repeat repeat;"> sudo apt-get install alsa-utils
</pre>
<p style="display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 19.1875px; font-family: sans-serif; height: 19px; margin: 5.119999885559082px 0px 6.400000095367432px; padding: 0px; text-decoration: initial; width: 1127px;">and edit the file /etc/modules using:
</p>
<pre style="background-image: none; background-attachment: scroll; background-origin: padding-box; background-clip: border-box; background-color: rgb(249, 249, 249); background-size: auto; border: 1px dashed rgb(47, 111, 171); display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 16.625px; font-family: monospace, Courier; height: 16px; margin: 12.800000190734863px 0px; padding: 12.796875px; text-decoration: initial; white-space: pre; width: 1099.40625px; background-position: 0% 0%; background-repeat: repeat repeat;"> sudo nano /etc/modules
</pre>
<p style="display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 19.1875px; font-family: sans-serif; height: 19px; margin: 5.119999885559082px 0px 6.400000095367432px; padding: 0px; text-decoration: initial; width: 1127px;">to have line:
</p>
<pre style="background-image: none; background-attachment: scroll; background-origin: padding-box; background-clip: border-box; background-color: rgb(249, 249, 249); background-size: auto; border: 1px dashed rgb(47, 111, 171); display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 16.625px; font-family: monospace, Courier; height: 16px; margin: 12.800000190734863px 0px; padding: 12.796875px; text-decoration: initial; white-space: pre; width: 1099.40625px; background-position: 0% 0%; background-repeat: repeat repeat;"> snd_bcm2835
</pre>
<p style="display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 19.1875px; font-family: sans-serif; height: 19px; margin: 5.119999885559082px 0px 6.400000095367432px; padding: 0px; text-decoration: initial; width: 1127px;">If this line is already there then leave the file as is!
</p><p style="display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 19.1875px; font-family: sans-serif; height: 19px; margin: 5.119999885559082px 0px 6.400000095367432px; padding: 0px; text-decoration: initial; width: 1127px;">Install the mplayer audio/movie player with:
</p>
<pre style="background-image: none; background-attachment: scroll; background-origin: padding-box; background-clip: border-box; background-color: rgb(249, 249, 249); background-size: auto; border: 1px dashed rgb(47, 111, 171); display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 16.625px; font-family: monospace, Courier; height: 16px; margin: 12.800000190734863px 0px; padding: 12.796875px; text-decoration: initial; white-space: pre; width: 1099.40625px; background-position: 0% 0%; background-repeat: repeat repeat;">sudo apt-get install mplayer
</pre>
<p style="display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 19.1875px; font-family: sans-serif; height: 19px; margin: 5.119999885559082px 0px 6.400000095367432px; padding: 0px; text-decoration: initial; width: 1127px;">To sort out the mplayer error message, edit file /etc/mplayer/mplayer.conf using:
</p>
<pre style="background-image: none; background-attachment: scroll; background-origin: padding-box; background-clip: border-box; background-color: rgb(249, 249, 249); background-size: auto; border: 1px dashed rgb(47, 111, 171); display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 16.625px; font-family: monospace, Courier; height: 16px; margin: 12.800000190734863px 0px; padding: 12.796875px; text-decoration: initial; white-space: pre; width: 1099.40625px; background-position: 0% 0%; background-repeat: repeat repeat;"> sudo nano /etc/mplayer/mplayer.conf
</pre>
<p style="display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 19.1875px; font-family: sans-serif; height: 19px; margin: 5.119999885559082px 0px 6.400000095367432px; padding: 0px; text-decoration: initial; width: 1127px;">to add line
</p>
<pre style="background-image: none; background-attachment: scroll; background-origin: padding-box; background-clip: border-box; background-color: rgb(249, 249, 249); background-size: auto; border: 1px dashed rgb(47, 111, 171); display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 16.625px; font-family: monospace, Courier; height: 16px; margin: 12.800000190734863px 0px; padding: 12.796875px; text-decoration: initial; white-space: pre; width: 1099.40625px; background-position: 0% 0%; background-repeat: repeat repeat;">nolirc=yes
</pre>
<h2 style="display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 19px; line-height: 19.1875px; font-family: sans-serif; height: 19px; margin: 0px 0px 11.520000457763672px; overflow: hidden; padding: 9.59375px 0px 3.25px; text-decoration: initial; width: 1127px;"> <span style="display: inline; font-style: normal; font-variant: normal; font-weight: normal; font-size: 19px; line-height: 19.1875px; font-family: sans-serif; margin: 0px; padding: 0px; text-decoration: initial;"> Festival Text to Speech </span></h2>
<p style="display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 19.1875px; font-family: sans-serif; height: 19px; margin: 5.119999885559082px 0px 6.400000095367432px; padding: 0px; text-decoration: initial; width: 1127px;">The first speech package I tried was Festival. It worked fine and produces a voice like a rough sounding robot. This may be just what you need if you are adding speech to your RPi robot project.
</p><p style="display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 19.1875px; font-family: sans-serif; height: 19px; margin: 5.119999885559082px 0px 6.400000095367432px; padding: 0px; text-decoration: initial; width: 1127px;">Install Festival with:
</p>
<pre style="background-image: none; background-attachment: scroll; background-origin: padding-box; background-clip: border-box; background-color: rgb(249, 249, 249); background-size: auto; border: 1px dashed rgb(47, 111, 171); display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 16.625px; font-family: monospace, Courier; height: 16px; margin: 12.800000190734863px 0px; padding: 12.796875px; text-decoration: initial; white-space: pre; width: 1099.40625px; background-position: 0% 0%; background-repeat: repeat repeat;"> sudo apt-get install festival
</pre>
<p style="display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 19.1875px; font-family: sans-serif; height: 19px; margin: 5.119999885559082px 0px 6.400000095367432px; padding: 0px; text-decoration: initial; width: 1127px;">Try out Festival with:
</p>
<pre style="background-image: none; background-attachment: scroll; background-origin: padding-box; background-clip: border-box; background-color: rgb(249, 249, 249); background-size: auto; border: 1px dashed rgb(47, 111, 171); display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 16.625px; font-family: monospace, Courier; height: 16px; margin: 12.800000190734863px 0px; padding: 12.796875px; text-decoration: initial; white-space: pre; width: 1099.40625px; background-position: 0% 0%; background-repeat: repeat repeat;"> echo “Just what do you think you're doing, Dave?” | festival --tts
</pre>
<p style="display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 19.1875px; font-family: sans-serif; height: 19px; margin: 5.119999885559082px 0px 6.400000095367432px; padding: 0px; text-decoration: initial; width: 1127px;">or to speak RPi’s IP address:
</p>
<pre style="background-image: none; background-attachment: scroll; background-origin: padding-box; background-clip: border-box; background-color: rgb(249, 249, 249); background-size: auto; border: 1px dashed rgb(47, 111, 171); display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 16.625px; font-family: monospace, Courier; height: 16px; margin: 12.800000190734863px 0px; padding: 12.796875px; text-decoration: initial; white-space: pre; width: 1099.40625px; background-position: 0% 0%; background-repeat: repeat repeat;"> hostname -I | festival -tts
</pre>
<h2 style="display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 19px; line-height: 19.1875px; font-family: sans-serif; height: 19px; margin: 0px 0px 11.520000457763672px; overflow: hidden; padding: 9.59375px 0px 3.25px; text-decoration: initial; width: 1127px;"> <span style="display: inline; font-style: normal; font-variant: normal; font-weight: normal; font-size: 19px; line-height: 19.1875px; font-family: sans-serif; margin: 0px; padding: 0px; text-decoration: initial;"> Espeak Text to Speech </span></h2>
<p style="display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 19.1875px; font-family: sans-serif; height: 38px; margin: 5.119999885559082px 0px 6.400000095367432px; padding: 0px; text-decoration: initial; width: 1127px;">Espeak is a more modern speech synthesis package than Festival. It sounds clearer but does wail a little. If you are making an alien or a RPi witch then it’s the one for you! Seriously it is a good allrounder with great customisation options.
</p><p style="display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 19.1875px; font-family: sans-serif; height: 19px; margin: 5.119999885559082px 0px 6.400000095367432px; padding: 0px; text-decoration: initial; width: 1127px;">Install Espeak with:
</p>
<pre style="background-image: none; background-attachment: scroll; background-origin: padding-box; background-clip: border-box; background-color: rgb(249, 249, 249); background-size: auto; border: 1px dashed rgb(47, 111, 171); display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 16.625px; font-family: monospace, Courier; height: 16px; margin: 12.800000190734863px 0px; padding: 12.796875px; text-decoration: initial; white-space: pre; width: 1099.40625px; background-position: 0% 0%; background-repeat: repeat repeat;">sudo apt-get install espeak
</pre>
<p style="display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 19.1875px; font-family: sans-serif; height: 19px; margin: 5.119999885559082px 0px 6.400000095367432px; padding: 0px; text-decoration: initial; width: 1127px;">Test Espeak with:
English female voice, emphasis on capitals (-k), speaking slowly (-s) using direct text:-
</p>
<pre style="background-image: none; background-attachment: scroll; background-origin: padding-box; background-clip: border-box; background-color: rgb(249, 249, 249); background-size: auto; border: 1px dashed rgb(47, 111, 171); display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 16.625px; font-family: monospace, Courier; height: 16px; margin: 12.800000190734863px 0px; padding: 12.796875px; text-decoration: initial; white-space: pre; width: 1099.40625px; background-position: 0% 0%; background-repeat: repeat repeat;"> espeak -ven+f3 -k5 -s150 "I've just picked up a fault in the AE35 unit"
</pre>
<h2 style="display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 19px; line-height: 19.1875px; font-family: sans-serif; height: 19px; margin: 0px 0px 11.520000457763672px; overflow: hidden; padding: 9.59375px 0px 3.25px; text-decoration: initial; width: 1127px;"> <span style="display: inline; font-style: normal; font-variant: normal; font-weight: normal; font-size: 19px; line-height: 19.1875px; font-family: sans-serif; margin: 0px; padding: 0px; text-decoration: initial;"> Google Text to Speech </span></h2>
<p style="display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 19.1875px; font-family: sans-serif; height: 38px; margin: 5.119999885559082px 0px 6.400000095367432px; padding: 0px; text-decoration: initial; width: 1127px;">Google’s Text to Speech engine is a little different to Festival and Espeak. Your text is sent to Google’s servers to generate the speech file which is then returned to your Pi and played using mplayer. This means you will need an internet connection for it to work, but the speech quality is superb.
</p><p style="display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 19.1875px; font-family: sans-serif; height: 19px; margin: 5.119999885559082px 0px 6.400000095367432px; padding: 0px; text-decoration: initial; width: 1127px;">I used used ax206geek’s bash script to access the Google Text to Speech engine:
</p><p style="display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 19.1875px; font-family: sans-serif; height: 19px; margin: 5.119999885559082px 0px 6.400000095367432px; padding: 0px; text-decoration: initial; width: 1127px;">Create a file speech.sh with:
</p>
<pre style="background-image: none; background-attachment: scroll; background-origin: padding-box; background-clip: border-box; background-color: rgb(249, 249, 249); background-size: auto; border: 1px dashed rgb(47, 111, 171); display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 16.625px; font-family: monospace, Courier; height: 16px; margin: 12.800000190734863px 0px; padding: 12.796875px; text-decoration: initial; white-space: pre; width: 1099.40625px; background-position: 0% 0%; background-repeat: repeat repeat;"> nano speech.sh
</pre>
<p style="display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 19.1875px; font-family: sans-serif; height: 19px; margin: 5.119999885559082px 0px 6.400000095367432px; padding: 0px; text-decoration: initial; width: 1127px;">Add these lines to the file and save it (in nano editor use CTRL-O writeOut)
</p>
<pre style="background-image: none; background-attachment: scroll; background-origin: padding-box; background-clip: border-box; background-color: rgb(249, 249, 249); background-size: auto; border: 1px dashed rgb(47, 111, 171); display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 16.625px; font-family: monospace, Courier; height: 48px; margin: 12.800000190734863px 0px; padding: 12.796875px; text-decoration: initial; white-space: pre; width: 1099.40625px; background-position: 0% 0%; background-repeat: repeat repeat;">#!/bin/bash
say() { local IFS=+;/usr/bin/mplayer -ao alsa -really-quiet -noconsolecontrols "<a rel="nofollow" href="http://translate.google.com/translate_tts?tl=en&q=$*" style="background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAVklEQVR4Xn3PgQkAMQhDUXfqTu7kTtkpd5RA8AInfArtQ2iRXFWT2QedAfttj2FsPIOE1eCOlEuoWWjgzYaB/IkeGOrxXhqB+uA9Bfcm0lAZuh+YIeAD+cAqSz4kCMUAAAAASUVORK5CYII=); background-attachment: scroll; background-origin: padding-box; background-clip: border-box; background-color: rgba(0, 0, 0, 0); background-size: auto; border: 0px none rgb(51, 102, 187); color: rgb(51, 102, 187); display: inline; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 16.625px; font-family: monospace, Courier; margin: 0px; outline: rgb(51, 102, 187) none 0px; padding: 0px 13px 0px 0px; text-decoration: initial; white-space: pre; background-position: 100% 50%; background-repeat: no-repeat no-repeat;">http://translate.google.com/translate_tts?tl=en&q=$*</a>"; }
say $*
</pre>
<p style="display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 19.1875px; font-family: sans-serif; height: 19px; margin: 5.119999885559082px 0px 6.400000095367432px; padding: 0px; text-decoration: initial; width: 1127px;">Alternatively save from here: <a href="http://elinux.org/File:Speech.sh" title="File:Speech.sh" style="border: 0px none rgb(6, 69, 173); color: rgb(6, 69, 173); display: inline; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 19.1875px; font-family: sans-serif; margin: 0px; outline: rgb(6, 69, 173) none 0px; padding: 0px; text-decoration: initial;">File:Speech.sh</a>
</p><p style="display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 19.1875px; font-family: sans-serif; height: 19px; margin: 5.119999885559082px 0px 6.400000095367432px; padding: 0px; text-decoration: initial; width: 1127px;">Add execute permissions to your script with:
</p>
<pre style="background-image: none; background-attachment: scroll; background-origin: padding-box; background-clip: border-box; background-color: rgb(249, 249, 249); background-size: auto; border: 1px dashed rgb(47, 111, 171); display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 16.625px; font-family: monospace, Courier; height: 16px; margin: 12.800000190734863px 0px; padding: 12.796875px; text-decoration: initial; white-space: pre; width: 1099.40625px; background-position: 0% 0%; background-repeat: repeat repeat;">chmod u+x speech.sh
</pre>
<p style="display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 19.1875px; font-family: sans-serif; height: 19px; margin: 5.119999885559082px 0px 6.400000095367432px; padding: 0px; text-decoration: initial; width: 1127px;">Test it using:
</p>
<pre style="background-image: none; background-attachment: scroll; background-origin: padding-box; background-clip: border-box; background-color: rgb(249, 249, 249); background-size: auto; border: 1px dashed rgb(47, 111, 171); display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 16.625px; font-family: monospace, Courier; height: 16px; margin: 12.800000190734863px 0px; padding: 12.796875px; text-decoration: initial; white-space: pre; width: 1099.40625px; background-position: 0% 0%; background-repeat: repeat repeat;">./speech.sh Look Dave, I can see you're really upset about this.
</pre>
<h2 style="display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 19px; line-height: 19.1875px; font-family: sans-serif; height: 19px; margin: 0px 0px 11.520000457763672px; overflow: hidden; padding: 9.59375px 0px 3.25px; text-decoration: initial; width: 1127px;"> <span style="display: inline; font-style: normal; font-variant: normal; font-weight: normal; font-size: 19px; line-height: 19.1875px; font-family: sans-serif; margin: 0px; padding: 0px; text-decoration: initial;"> Recommendations </span></h2>
<p style="display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 19.1875px; font-family: sans-serif; height: 57px; margin: 5.119999885559082px 0px 6.400000095367432px; padding: 0px; text-decoration: initial; width: 1127px;">I hope this guide has given you some ideas of how you can make use of speech output in your own project. As to which speech package to recommend, Festival works well enough, Espeak is clearer and so easier to understand and the Google engine gives super quality but is useless if you internet connection goes down. Maybe implement a speech function which first does a ping to Google before deciding whether to use Google or Espeak as its output engine?
</p><p style="display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 19.1875px; font-family: sans-serif; height: 19px; margin: 5.119999885559082px 0px 6.400000095367432px; padding: 0px; text-decoration: initial; width: 1127px;">All comments/suggestions welcome! Let me know for what you have used speech on your Pi - StevenP on the official Raspberry Pi Forum.
</p>
<!--
NewPP limit report
Preprocessor visited node count: 23/1000000
Preprocessor generated node count: 28/1000000
Post-expand include size: 0/2097152 bytes
Template argument size: 0/2097152 bytes
Highest expansion depth: 2/40
Expensive parser function count: 0/100
-->
<!-- Saved in parser cache with key elinux:pcache:idhash:29264-0!*!*!!en!2!* and timestamp 20130126023925 -->
</div></div></body></html>