README.fhem-speech 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  1. NAME
  2. fhem-speech - Synthesized voice (based on MBROLA) extension for FHEM
  3. SYNOPSIS
  4. fhem-speech -d device [-achopqS]
  5. fhem-speech -d device --set state [-hp]
  6. fhem-speech -f file [-acoqS]
  7. fhem-speech -t "text" [-acoqS]
  8. fhem-speech [-HmV?]
  9. Try `fhem-speech --man` for full manual!
  10. DESCRIPTION
  11. fhem-speech
  12. fhem-speech read the status of a FHEM device and talk using the MBROLA
  13. speech synthesizer. Furthermore it can read the content of a given file
  14. or text.
  15. FHEM
  16. FHEM is used to automate some common tasks in the household like
  17. switching lamps/shutters/heating/etc. and to log events like
  18. temperature/humidity/power consumption. Visit the FHEM's homepage
  19. <http://www.koeniglich.de/fhem/fhem.html> for more information.
  20. The MBROLA project
  21. Central to the MBROLA project is MBROLA, a speech synthesizer based on
  22. the concatenation of diphones. It takes a list of phonemes as input,
  23. together with prosodic information, and produces speech samples on 16
  24. bits (linear), at the sampling frequency of the diphone database used.
  25. This synthesizer is provided for free, for non commercial, non military
  26. applications only. Visit the MBROLA's homepage
  27. <http://tcts.fpms.ac.be/synthesis/> for more information.
  28. Asterisk
  29. Optionally fhem-speech supports AGI commands to communicate with
  30. Asterisk. Visit the Asterisk(R) homepage <http://www.asterisk.org/> for
  31. more information.
  32. OPTIONS
  33. Mandatory arguments to long options are mandatory for short options too.
  34. Ordering Options:
  35. -d, --device device
  36. Run in FHEM mode. Specifies the FHEM device to be queried. The given
  37. device must be defined.
  38. -f, --file file-name
  39. Run in file mode. fhem-speech will read the given file.
  40. -t, --text "TEXT"
  41. Run in Speaker's mode. fhem-speech will read the given "TEXT".
  42. Other options:
  43. -a, --asterisk
  44. Run in Asterisk mode. fhem-speech print out AGI-commands for direct
  45. usage in Asterisk.
  46. -c, --cache directory
  47. Specifies the location of where the files should be saved if
  48. fhem-speech started with the -o or --out argument.
  49. Default location: current directory.
  50. --force
  51. Overwrites existing files.
  52. -h, --host host
  53. Specifies the hostaddress for FHEM.
  54. Default address: "localhost".
  55. -o, --out [gsm|wav]
  56. fhem-speech saves the output to a file with the specified output
  57. format.
  58. Default address: "localhost".
  59. -p, --port port
  60. Communicate with FHEM on defined port.
  61. Default port: "7072".
  62. --prefix prefix
  63. Set the given prefix in front of filename.
  64. -q, --quiet
  65. Run in quiet mode.
  66. --set state
  67. Send <state> to device.
  68. -S, --sex [f|m]
  69. Specifies the sex for the voice. It depends on which voices for
  70. MBROLA have been installed.
  71. Default: "de3" for the German female voice and "de2" for the German
  72. male voice.
  73. -m, --man
  74. Show the manual page and exits.
  75. -H, --help
  76. Show a brief help message and exits.
  77. -V, --version
  78. Show fhem-speech's version number and exit.
  79. EXAMPLES
  80. Get status information for device <EG.wz.HZ> in quiet mode:
  81. `fhem-speech -d EG.wz.HZ -q`
  82. Same as above with a male voice. FHEM runs on IP 192.168.1.100:
  83. `fhem-speech -d EG.wz.HZ -S m -h 192.168.1.100`
  84. Get status information for device <EG.wz.HZ> in Asterisk mode:
  85. `fhem-speech -d EG.wz.HZ -a -q -o gsm -c /var/lib/asterisk/sounds/fhem/`
  86. Read the file <foobar>:
  87. `fhem-speech -f foobar`
  88. Read the given text "Geht nicht gibt's nicht.":
  89. `fhem-speech -t "Geht nicht gibt's nicht."`
  90. Set the state for device <EG.wz.SD.01>:
  91. `fhem-speech -d EG.wz.SD.01 --set on`
  92. INSTALLATION
  93. Requirements
  94. MBROLA
  95. You need MBROLA synthesizer, a synthesis voice, txt2pho and sox. For
  96. more information visit:
  97. o MBROLA project, <http://tcts.fpms.ac.be/synthesis/>
  98. o hadifix, <http://www.ikp.uni-bonn.de/dt/forsch/phonetik/hadifix/>
  99. FHEM
  100. For FHEM mode you need FHEM 4.5+ and the command extension "jsonlist".
  101. For more information take a look at:
  102. <fhem_src_path>/contrib/JsonList/README.JsonList
  103. or visit the FHEM's homepage:
  104. <http://www.koeniglich.de/fhem/fhem.html>
  105. JSON::XS
  106. The required command extension "jsonlist" send the result as a JSON
  107. encoded string. fhem-speech need the Perl module JSON::XS to decode the
  108. information.
  109. There are several ways to install the module:
  110. You can download the last version at:
  111. <http://search.cpan.org/~mlehmann/JSON-XS-2.231/XS.pm>
  112. Or you can use the package from the contrib-folder which was delivered
  113. with fhem-speech.
  114. You can use the cpan command on bash-prompt.
  115. Installation
  116. This describes the installation on ubuntu:
  117. Make a temporarily directory for the needed files and change to the new
  118. directory, e.g.:
  119. `mkdir /usr/local/src/mbrola; cd !$`
  120. Download the required files:
  121. `wget http://www.ikp.uni-bonn.de/dt/forsch/phonetik/hadifix/txt2pho.zip`
  122. `wget http://tcts.fpms.ac.be/synthesis/mbrola/bin/pclinux/mbrola3.0.1h_i386.deb`
  123. Download at least one synthesis voice (e.g. German female voice):
  124. `wget http://tcts.fpms.ac.be/synthesis/mbrola/dba/de3/de3.zip`
  125. txt2pho
  126. Install txt2pho:
  127. `unzip txt2pho.zip -d /usr/share/`
  128. `chmod 755 /usr/share/txt2pho/txt2pho`
  129. Edit txt2phorc:
  130. `vi /usr/share/txt2pho/txt2phorc`
  131. and change the path for DATAPATH and INVPATH:
  132. DATAPATH=/usr/share/txt2pho/data/
  133. INVPATH=/usr/share/txt2pho/data/
  134. Copy txt2phorc to /etc/txt2pho:
  135. `cp /usr/share/txt2pho/txt2phorc /etc/txt2pho`
  136. Synthesis Voice
  137. Install the synthesis voice (e.g. German female voice):
  138. `unzip de7.zip -d /usr/share/mbrola/de7`
  139. fhem-speech use "de2" and "de3" as default voices. You can change this
  140. if you like.
  141. MBROLA
  142. Install MBROLA:
  143. `dpkg -i mbrola3.0.1h_i386.deb`
  144. sox
  145. Install sox:
  146. `apt-get install sox libsox-fmt-all`
  147. Test
  148. Test your installation:
  149. `echo "Test" | /usr/share/txt2pho/txt2pho |\
  150. mbrola /usr/share/mbrola/de7/de7 - -.au | play -q -t au -`
  151. fhem-speech
  152. Copy the script fhem-speech to a directory of your choice, e.g.:
  153. `cp fhem-speech /usr/local/bin`
  154. and make it executable:
  155. `chmod 775 /usr/local/bin/fhem-speech`
  156. Perl
  157. If you use the delivered module contrib/JSON-XS-2.231.tar.gz:
  158. `tar xzf JSON-XS-2.231.tar.gz`
  159. `cd JSON-XS-2.231`
  160. `perl Makefile.pl`
  161. `make`
  162. `make test`
  163. and as root:
  164. `make install`
  165. CONFIGURATION
  166. Open fhem-speech with your prefered editor.
  167. FHEM host settings
  168. Change the default host, if you like:
  169. ###########################
  170. # FHEM
  171. $sys{fhem}{host} = "localhost";
  172. $sys{fhem}{port} = "7072";
  173. External commands
  174. Change the paths depending on the installed distribution:
  175. ###########################
  176. # Mandatory external Files
  177. $sys{file}{mbrola} = "/usr/local/bin/mbrola";
  178. $sys{file}{pipefilt} = "/usr/local/bin/pipefilt";
  179. $sys{file}{play} = "/usr/bin/play";
  180. $sys{file}{preproc} = "/usr/local/bin/preproc";
  181. [...]
  182. Change the default settings for synthesis voice:
  183. ###########################
  184. # mbrola / txt2pho options
  185. $sys{speech}{sex} = "f";
  186. $sys{speech}{male} = "-f0.8 -t0.9 -l 15000";
  187. $sys{speech}{female} = "-f1.2 -t1.0 -l 22050";
  188. Translation
  189. fhem-speech need the $lang{} settings to decide what messages from FHEM
  190. to be spoken. For example take a look at the FHT part:
  191. ###########################
  192. # FHEM Translation
  193. [...]
  194. ###########################
  195. # FHT
  196. # keys:
  197. $lang{'actuator'} = "Ventilstellung: %s Prozent";
  198. $lang{'day-temp'} = "Temperatur Tag: %s Grad";
  199. $lang{'desired-temp'} = "Angeforderte Temperatur: %s Grad";
  200. $lang{'measured-temp'} = "Gemessene Temperatur: %s Grad";
  201. $lang{'mode'} = "Modus: %s";
  202. $lang{'night-temp'} = "Temperatur Nacht: %s Grad";
  203. $lang{'windowopen-temp'} = "Temperatur Fenster offen: %s Grad";
  204. [...]
  205. On every FHEM response all of the defined $lang{} status information
  206. will be spoken. If you don't like status information for e.g.
  207. 'windowopen-temp' then comment this out:
  208. # $lang{'windowopen-temp'} = "Temperatur Fenster offen: %s Grad";
  209. If you like to know the status for e.g. 'lowtemp-offset' add a line like
  210. this:
  211. $lang{'lowtemp-offset'} = "Versatz Temperatur %s Grad";
  212. The '%s' stands as a placeholder for the value.
  213. OPTIONAL
  214. Asterisk
  215. fhem-speech support AGI commands for direct output in Asterisk.
  216. Wrapper
  217. If you like fhem-speech for use in Asterisk, you have to install a
  218. wrapper around fhem-speech. You can use the example from
  219. contrib/fhem-speech.agi.
  220. Copy the wrapper to your asterisk-environment, e.g:
  221. `cp contrib/fhem-speech.agi /var/lib/asterisk/agi-bin/`
  222. extension.conf
  223. Take a look at the example from contrib/extension.conf.
  224. LEGALESE
  225. License GPLv3+: GNU GPL version 3 or later
  226. <http://gnu.org/licenses/gpl.html>.
  227. This is free software: you are free to change and redistribute it. There
  228. is NO WARRANTY, to the extent permitted by law.
  229. AUTHOR
  230. Copyright (C) 2008 Martin Fischer <m_fischer@gmx.de>