# Allow webserver to create files and request to var/www/tts

**URL:** <https://community.openhab.org/t/allow-webserver-to-create-files-and-request-to-var-www-tts/17211>\
**Category:** Text-to-Speech\
**Created:** [November 24, 2016, 6:19pm UTC](https://community.openhab.org/t/allow-webserver-to-create-files-and-request-to-var-www-tts/17211 "2016-11-24T18:19:09Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nguy\_n\_Phuc\_Anh\_D\_ng](https://community.openhab.org/letter_avatar_proxy/v4/letter/n/ccd318/32.png) [@Nguy\_n\_Phuc\_Anh\_D\_ng](https://community.openhab.org/u/Nguy_n_Phuc_Anh_D_ng)\
**Post date:** [November 24, 2016, 6:19pm UTC](https://community.openhab.org/t/allow-webserver-to-create-files-and-request-to-var-www-tts/17211/1 "2016-11-24T18:19:10Z")

</div>

I want to implement a local TTS engine on my raspberry pi so I followed this link:

> [@GoogleTTS responding with 503 error (even after the URL fix)](https://community.openhab.org/t/googletts-responding-with-503-error-even-after-the-url-fix/3385/19):
>
> Hey guys, I spent some time today playing around with pico2wave and building a simple PHP script to replicate what the Google TTS service does. Had some reasonable success, instructions below. You should be able to run this on a local server (using apache or the like) and then point your Google TTS binding to this URL. It expects two parameters in the URL - language (e.g. en-GB) and message to translate. Installation install the necessary dependencies (pico2wave, lame) sudo apt-get install…

The problem is @ben_jones12 said that:

> [@GoogleTTS responding with 503 error (even after the URL fix)](https://community.openhab.org/t/googletts-responding-with-503-error-even-after-the-url-fix/3385/19):
>
> ensure your web server has sufficient permissions to create files in this directory (e.g. owned by www-data)

and

> [@GoogleTTS responding with 503 error (even after the URL fix)](https://community.openhab.org/t/googletts-responding-with-503-error-even-after-the-url-fix/3385/19):
>
> setup your web server to allow requests to /var/www/tts

As far as I know, I can use apache to config the web server to do the thing @ben_jones12 said, but I failed. Does anyone has experience of doing such thing before?  
Can you show me how to implement 2 things like @ben_jones12 mentioned above?

---

<div class="post-metadata">

**Author:** ![ben\_jones12](https://community.openhab.org/user_avatar/community.openhab.org/ben_jones12/32/52_2.png) [@ben\_jones12](https://community.openhab.org/u/ben_jones12)\
**Post date:** [November 24, 2016, 7:01pm UTC](https://community.openhab.org/t/allow-webserver-to-create-files-and-request-to-var-www-tts/17211/2 "2016-11-24T19:01:42Z")

</div>

You need to ensure the folder `/var/www/tts` is owned by `www-data`. Then add the following apache2 conf file;

```auto
###############################
# Local access to HTTP wrappers for TTS service
###############################
<Location /tts>
    Options None
    Order deny,allow
    Deny from all
    Allow from localhost
    Allow from 192.168.10.0/255.255.255.0
</Location>

```

---

<div class="post-metadata">

**Author:** ![Nguy\_n\_Phuc\_Anh\_D\_ng](https://community.openhab.org/letter_avatar_proxy/v4/letter/n/ccd318/32.png) [@Nguy\_n\_Phuc\_Anh\_D\_ng](https://community.openhab.org/u/Nguy_n_Phuc_Anh_D_ng)\
**Post date:** [November 24, 2016, 7:04pm UTC](https://community.openhab.org/t/allow-webserver-to-create-files-and-request-to-var-www-tts/17211/3 "2016-11-24T19:04:17Z")

</div>

Do I need to change the IP address in this line ?

```javascript
Allow from 192.168.10.0/255.255.255.0 

```

---

<div class="post-metadata">

**Author:** ![ben\_jones12](https://community.openhab.org/user_avatar/community.openhab.org/ben_jones12/32/52_2.png) [@ben\_jones12](https://community.openhab.org/u/ben_jones12)\
**Post date:** [November 24, 2016, 7:08pm UTC](https://community.openhab.org/t/allow-webserver-to-create-files-and-request-to-var-www-tts/17211/4 "2016-11-24T19:08:00Z")

</div>

Yes - that needs to match your LAN

---

<div class="post-metadata">

**Author:** ![Nguy\_n\_Phuc\_Anh\_D\_ng](https://community.openhab.org/letter_avatar_proxy/v4/letter/n/ccd318/32.png) [@Nguy\_n\_Phuc\_Anh\_D\_ng](https://community.openhab.org/u/Nguy_n_Phuc_Anh_D_ng)\
**Post date:** [November 24, 2016, 7:14pm UTC](https://community.openhab.org/t/allow-webserver-to-create-files-and-request-to-var-www-tts/17211/5 "2016-11-24T19:14:47Z")

</div>

so here is the thing I going to do, can you verify them:

1. sudo chown www-data: /var/www/tts
2. add the following code to /etc/apache2/apache2.conf file: (But the IP address is my raspberry pi’ IP address)

```javascript
###############################
# Local access to HTTP wrappers for TTS service
###############################
<Location /tts>
    Options None
    Order deny,allow
    Deny from all
    Allow from localhost
    Allow from 192.168.10.0/255.255.255.0
</Location>

```

---

<div class="post-metadata">

**Author:** ![Kai](https://community.openhab.org/user_avatar/community.openhab.org/kai/32/116281_2.png) [@Kai](https://community.openhab.org/u/Kai)\
**Post date:** [November 24, 2016, 7:26pm UTC](https://community.openhab.org/t/allow-webserver-to-create-files-and-request-to-var-www-tts/17211/6 "2016-11-24T19:26:09Z")

</div>

> [@Nguy\_n\_Phuc\_Anh\_D\_ng](#):
>
> I want to implement a local TTS

It would be much better to implement this directly as a bundle, which simply accesses the tts engine through command line calls - this would be less of a hack.

---

<div class="post-metadata">

**Author:** ![Nguy\_n\_Phuc\_Anh\_D\_ng](https://community.openhab.org/letter_avatar_proxy/v4/letter/n/ccd318/32.png) [@Nguy\_n\_Phuc\_Anh\_D\_ng](https://community.openhab.org/u/Nguy_n_Phuc_Anh_D_ng)\
**Post date:** [November 24, 2016, 7:35pm UTC](https://community.openhab.org/t/allow-webserver-to-create-files-and-request-to-var-www-tts/17211/7 "2016-11-24T19:35:49Z")

</div>

@Kai How can I do that? As I read on openhab github respository there are 2 sections about using local TTS

---

<div class="post-metadata">

**Author:** ![Nguy\_n\_Phuc\_Anh\_D\_ng](https://community.openhab.org/letter_avatar_proxy/v4/letter/n/ccd318/32.png) [@Nguy\_n\_Phuc\_Anh\_D\_ng](https://community.openhab.org/u/Nguy_n_Phuc_Anh_D_ng)\
**Post date:** [November 24, 2016, 7:42pm UTC](https://community.openhab.org/t/allow-webserver-to-create-files-and-request-to-var-www-tts/17211/8 "2016-11-24T19:42:26Z")

</div>

@Kai Furthermore, many thread on this forum said that several TTS engine bundle are unstable or gone away, such as voicesrr or MaryTTS, GoogleTTS…Can you show me what should I do to have a stable and acceptable quality TTS system without so many hacks? Thanks very much

I tried espeak,festival and I found the voice was quite robotic (from below link):

```auto

```

> **[RPi Text to Speech (Speech Synthesis) - eLinux.org](https://elinux.org/RPi_Text_to_Speech_(Speech_Synthesis))**

```auto

```

---

<div class="post-metadata">

**Author:** ![Kai](https://community.openhab.org/user_avatar/community.openhab.org/kai/32/116281_2.png) [@Kai](https://community.openhab.org/u/Kai)\
**Post date:** [November 24, 2016, 7:45pm UTC](https://community.openhab.org/t/allow-webserver-to-create-files-and-request-to-var-www-tts/17211/9 "2016-11-24T19:45:35Z")

</div>

> [@Nguy\_n\_Phuc\_Anh\_D\_ng](#):
>
> How can I do that?

Easiest to look at other TTS services are implemented: [https://github.com/openhab/openhab2-addons/tree/master/addons/voice/org.openhab.voice.voicerss](https://github.com/openhab/openhab2-addons/tree/master/addons/voice/org.openhab.voice.voicerss)

VoiceRSS actually gives quite decent results.

---

<div class="post-metadata">

**Author:** ![Nguy\_n\_Phuc\_Anh\_D\_ng](https://community.openhab.org/letter_avatar_proxy/v4/letter/n/ccd318/32.png) [@Nguy\_n\_Phuc\_Anh\_D\_ng](https://community.openhab.org/u/Nguy_n_Phuc_Anh_D_ng)\
**Post date:** [November 24, 2016, 7:46pm UTC](https://community.openhab.org/t/allow-webserver-to-create-files-and-request-to-var-www-tts/17211/10 "2016-11-24T19:46:41Z")

</div>

Is it still work with OH 1.8.3 ?  
EDIT: Is there any items and sitemaps,rules sample configuration to use this TTS service?

---

<div class="post-metadata">

**Author:** ![Nguy\_n\_Phuc\_Anh\_D\_ng](https://community.openhab.org/letter_avatar_proxy/v4/letter/n/ccd318/32.png) [@Nguy\_n\_Phuc\_Anh\_D\_ng](https://community.openhab.org/u/Nguy_n_Phuc_Anh_D_ng)\
**Post date:** [November 26, 2016, 4:14pm UTC](https://community.openhab.org/t/allow-webserver-to-create-files-and-request-to-var-www-tts/17211/11 "2016-11-26T16:14:49Z")

</div>

I installled voicerss in my raspberry pi 3 and I successfully tested it by using tts command on terminal. But when I tried using say command in the rules file, I couldn’t hear anything

So I think it is possible to write script file or .sh file so that we can activate TTS engine (VoiceRSS in this case) from those files. But I don’t know how to write it (my coding ability is extremely limited). I dont know how to call those script files from rules file, either.

So anyone can show me some examples and tips?  
Thanks sooo much!
