Skip to content

Commit ac522bd

Browse files
author
mochechan
committed
add google TTS engine
1 parent 0f6df0c commit ac522bd

File tree

4 files changed

+27
-2
lines changed

4 files changed

+27
-2
lines changed

index.html

+2
Original file line numberDiff line numberDiff line change
@@ -274,3 +274,5 @@
274274
</script>
275275
</body>
276276
</html>
277+
278+

newRPI.sh

+5-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
cat /proc/version
55
cat /proc/cpuinfo
6+
cat /proc/asound/cards # show all available sound cards
7+
cat /proc/asound/modules # show all available sound modules
68
vcgencmd measure_temp # show cpu temperature
79
vcgencmd get_mem arm && vcgencmd get_mem gpu # show free memory for cpu & gpu
810

@@ -11,7 +13,9 @@ sudo apt-get -y update
1113
sudo apt-get -y upgrade
1214
sudo apt-get -y dist-upgrade
1315

14-
sudo apt-get -y install vim screen git nodejs npm git-core lirc rtorrent
16+
sudo apt-get -y install vim screen git git-core lirc rtorrent alsa-utils mplayer festival
17+
# nodejs installed from apt-get is very old.
18+
echo nolirc=yes | tee -a /etc/mplayer/mplayer.conf
1519

1620
#sudo apt-get -y install python-pip
1721
#sudo pip install pibrella

speech_google.sh

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
say() { local IFS=+;/usr/bin/mplayer -ao alsa -really-quiet -noconsolecontrols "http://translate.google.com/translate_tts?tl=en&q=$*"; }
3+
say $*
4+
5+
exit 99;
6+
This script uses Google's Text to Speech engine. This means you will need an internet connection for it to work, but the speech quality is superb.
7+
http://elinux.org/RPi_Text_to_Speech_%28Speech_Synthesis%29
8+

web2.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* todo:
22
33
save server and clients' ip addresses
4+
AC auto temperature adjustment
45
relay1 supports temperature and countdown mode
56
auto open/close window with step motor
67
voice control: http://www.raspberrypi.org/meet-jasper-open-source-voice-computing/
@@ -9,7 +10,6 @@ to query all significient events
910
to startup automatically (/etc/rc.local is now fail)
1011
//to shutdown -r now when disconnected for a long time
1112
client can control by command line with username=control message=predefined
12-
AC auto temperature adjustment
1313
PIR hardware adjust
1414
*/
1515

@@ -254,27 +254,32 @@ exec("gpio mode 29 in ; gpio mode 25 in ; gpio mode 22 out ; gpio mode 26 out ",
254254
});
255255

256256
function relay1on () {
257+
exec("./speech_google.sh I am going to trun on the relay one.", function (error, stdout, stderr) {});
257258
exec("gpio write 22 0", function (error, stdout, stderr) {});
258259
status.relay1countdown = 0;
259260
}
260261

261262
function relay1off () {
263+
exec("./speech_google.sh I am going to trun off the relay one.", function (error, stdout, stderr) {});
262264
exec("gpio write 22 1", function (error, stdout, stderr) {});
263265
status.relay1countdown = 0;
264266
}
265267

266268
function relay2on () {
269+
exec("./speech_google.sh I am going to trun on the relay 2.", function (error, stdout, stderr) {});
267270
exec("gpio write 26 0", function (error, stdout, stderr) {});
268271
status.relay2countdown = 0;
269272
}
270273

271274
function relay2off () {
275+
exec("./speech_google.sh I am going to trun off the relay 2.", function (error, stdout, stderr) {});
272276
exec("gpio write 26 1", function (error, stdout, stderr) {});
273277
status.relay2countdown = 0;
274278
}
275279

276280
function ac (action) {
277281
console.log(action);
282+
exec("./speech_google.sh I am going to manipulate the air condition.", function (error, stdout, stderr) {});
278283
status.lastACstatus = action;
279284
if (action === 'ac_on') exec("irsend SEND_ONCE lircd_ac.conf power_on", function (error, stdout, stderr) {});
280285
else if (action === 'ac_off') exec("irsend SEND_ONCE lircd_ac.conf power_off", function (error, stdout, stderr) {});
@@ -345,5 +350,11 @@ var LOG = function (obj) {
345350
}
346351
}
347352

353+
/* current functions:
354+
2-way relay control
355+
IR LED and receiver; air condition tested
356+
web-based user interface with websocket
357+
Google's Text to Speech engine
358+
*/
348359

349360
// end of file

0 commit comments

Comments
 (0)