About This File
Text To Speach (TTS) solution for HC2 and Apple Mac (OS X) - version October 2017:
PREFACE :
I am happy to present my second approach for TTS (Text To Speech) and multi room audio for Fibaro HC2 and Apple OS X computer.
I call it “second approach” rather then second version because it uses different mechanism to control audio of the computer, however the goal remain the same.
That is also the reason why I decided to publish it in the new thread.
I hope that this guide let you setup TTS on your Fibaro HC2 and Mac computers.
INTRODUCTION :
I have noticed that wide used solution for TTS and multiroom is to use Sonos speakers (probably because of the Fibaro plugin available) and VoiceRSS (http://www.voicerss.org/).
My solution is different. It uses the text synthesizer (TTS) which we have already implemented in our computers and which can speak in variety of languages – also those not supported by VoiceRSS. To change text into speech I used “SAY” command of OS X. The other advantage is that we are independent on internet connection and there are no charges for TTS processing. It has also multiroom solution. You can have installed all over your place a number of speakers. The volume of each speaker can be individually adjusted from HC2 (Volume range from 0 to 100 %) so it is possible to select in which room/rooms you hear the voice announcement.
If you use the iTunes VD it is also possible to distribute music.
Integration of iTunes with and HC2 was discussed and published here :
The supported speakers/devices/protocols are as for now :
- Apple AirPlay
- Google Chromcast
- Bluetooth
- Windows computers (with installed app to become AirPlay compatible)
The supported languages/voices of OS X v. 10.12.2 (macOS Sierra) are listed in Paragraph 2 below.
WHAT WE NEED :
- Fibaro HC2
- Apple Mac computer
- Audio Mixer VD installed on HC2
- Some LUA experience to fine tune VD on HC2 and have your user defined TTS messages in your scenes
- Airfoil by Rouge Amoeba application installed on Mac - for TTS it is OK to use free demo version
- Fibaro TTS Bridge application for OS X by Marcin S. Milewski (gucio1234) installed on Mac
- Speakers/audio receivers (any from the list of compatible devices) :
. Apple AirPlay
. Google Chromcast
. Mac , Windows or Linux computer with Airfoil Satellite installed
( see https://rogueamoeba.com/airfoil/ )
. iOS or Android device with Airfoil Speakers installed
(if one wants to have TTS on mobile device)
. Bluetooth
The presented solution was tested with the following software versions / hardware :
- Fibaro HC 2 firmware 4.140
- Airfoil for Mac v. 5.5.1
- Airfoil Sattelite for Windows v.5.1.6
- OS X v. 10.12.2 (macOS Sierra) and OS X v. 10.13 (macOS High Sierra)
- Apple AirPort versions A1088, A1264, A1392
- JBL Flip 3 Bluetooth Speaker
- Fibaro TTS Bridge v. 0.1
- Fibaro HC 2 v. 4.110
It was not tested with Google Chromcast (as I do not have any) but this is supported by Airfoil.
IMPLEMENTATION :
Please read the whole instruction carefully before you start.
1.
Define the global variable “PAMessage” in your HC2 (top part of the Variables’ Panel):
This variable will store the text you want to convert to speech, whatever is there, the system will speak when you press TTS button of the VD
2.
Test and select desired language/voice for your TTS.
To change text into speech we used “SAY” command of OS X.
Open “Terminal “ application on your Mac.
Type ‘SAY –v ?’ to see the list of available voices/languages
Type ‘SAY –v <name of the voice>’ to select the voice of your preference
Type ‘SAY “THIS IS A TEST MESSGE IN MY LANGUAGE” ’ to test your selected voice
More details on this can be found here: https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man1/say.1.html
Here is the result of
‘SAY –v ?’ :
Alex en_US # Most people recognize me by my voice. Alice it_IT # Salve, mi chiamo Alice e sono una voce italiana. Alva sv_SE # Hej, jag heter Alva. Jag är en svensk röst. Amelie fr_CA # Bonjour, je m’appelle Amelie. Je suis une voix canadienne. Anna de_DE # Hallo, ich heiße Anna und ich bin eine deutsche Stimme. Carmit he_IL # שלום. קוראים לי כרמית, ואני קול בשפה העברית. Damayanti id_ID # Halo, nama saya Damayanti. Saya berbahasa Indonesia. Daniel en_GB # Hello, my name is Daniel. I am a British-English voice. Diego es_AR # Hola, me llamo Diego y soy una voz española. Ellen nl_BE # Hallo, mijn naam is Ellen. Ik ben een Belgische stem. Ewa pl_PL # Witaj. Mam na imię Ewa, jestem głosem kobiecym dla języka polskiego. Fiona en-scotland # Hello, my name is Fiona. I am a Scottish-English voice. Fred en_US # I sure like being inside this fancy computer Ioana ro_RO # Bună, mă cheamă Ioana . Sunt o voce românească. Joana pt_PT # Olá, chamo-me Joana e dou voz ao português falado em Portugal. Jorge es_ES # Hola, me llamo Jorge y soy una voz española. Juan es_MX # Hola, me llamo Juan y soy una voz mexicana. Kanya th_TH # สวัสดีค่ะ ดิฉันชื่อKanya Karen en_AU # Hello, my name is Karen. I am an Australian-English voice. Kyoko ja_JP # こんにちは、私の名前はKyokoです。日本語の音声をお届けします。 Laura sk_SK # Ahoj. Volám sa Laura . Som hlas v slovenskom jazyku. Lekha hi_IN # नमस्कार, मेरा नाम लेखा है.Lekha मै हिंदी मे बोलने वाली आवाज़ हूँ. Luca it_IT # Salve, mi chiamo Luca e sono una voce italiana. Luciana pt_BR # Olá, o meu nome é Luciana e a minha voz corresponde ao português que é falado no Brasil Maged ar_SA # مرحبًا اسمي Maged. أنا عربي من السعودية. Mariska hu_HU # Üdvözlöm! Mariska vagyok. Én vagyok a magyar hang. Mei-Jia zh_TW # 您好,我叫美佳。我說國語。 Melina el_GR # Γεια σας, ονομάζομαι Melina. Είμαι μια ελληνική φωνή. Milena ru_RU # Здравствуйте, меня зовут Milena. Я – русский голос системы. Moira en_IE # Hello, my name is Moira. I am an Irish-English voice. Monica es_ES # Hola, me llamo Monica y soy una voz española. Nora nb_NO # Hei, jeg heter Nora. Jeg er en norsk stemme. Paulina es_MX # Hola, me llamo Paulina y soy una voz mexicana. Samantha en_US # Hello, my name is Samantha. I am an American-English voice. Sara da_DK # Hej, jeg hedder Sara. Jeg er en dansk stemme. Satu fi_FI # Hei, minun nimeni on Satu. Olen suomalainen ääni. Sin-ji zh_HK # 您好,我叫 Sin-ji。我講廣東話。 Tessa en_ZA # Hello, my name is Tessa. I am a South African-English voice. Thomas fr_FR # Bonjour, je m’appelle Thomas. Je suis une voix française. Ting-Ting zh_CN # 您好,我叫Ting-Ting。我讲中文普通话。 Veena en_IN # Hello, my name is Veena. I am an Indian-English voice. Victoria en_US # Isn't it nice to have a computer that will talk to you? Xander nl_NL # Hallo, mijn naam is Xander. Ik ben een Nederlandse stem. Yelda tr_TR # Merhaba, benim adım Yelda. Ben Türkçe bir sesim. Yuna ko_KR # 안녕하세요. 제 이름은 Yuna입니다. 저는 한국어 음성입니다. Yuri ru_RU # Здравствуйте, меня зовут Yuri. Я – русский голос системы. Zosia pl_PL # Witaj. Mam na imię Zosia, jestem głosem kobiecym dla języka polskiego. Zuzana cs_CZ # Dobrý den, jmenuji se Zuzana. Jsem český hlas.
3.
Install “Airfoil” for Mac downloaded from https://rogueamoeba.com/airfoil/
NOTE: The free demo version lets to transmit audio up to 10 minutes long (which is more than enough for TTS). After that time the noise distortion will be added by the application.
If one wants to use Airfoil for transmission of music it is recommended to purchase a license.
4.
Setup web server with PHP Module running on our Mac computer.
In my case I have it on iMac and I followed this guide :
https://medium.com/@JohnFoderaro/how-to-set-up-apache-in-macos-sierra-10-12-bca5a5dfffba
I skipped "Configuring Virtual Hosts" as that was not working for me.
As my web server is accessible only by my devices, I did not care.
Important is that apache web server is managing PHP scripts .
NOTE: If you already implemented iTunes VD, you should have already running web server with PHP module installed.
5.
Install Audio Mixer VD on your HC 2.
Define parameters of this VD :
Set IP address of your Apple Mac computer
Set port number as 7000. The communication between HC2 and Mac will be on port 7000 and this is hard coded in “Fibaro TTS Bridge v..1” application.
Define in VD as many audio mixer sliders as you have audio devices to be linked with your multi room audio system.
In the VD attached FOR EACH SLIDER you have to define the PATH for your PHP script “airfoil.php”. Also for each slider the local variable ‘pokoj’ has to be defined as substring of the ID of the speakers defined in Airfoil app on Mac.
(see Paragraph 6 “How to know the IDs of your speakers defined for AirFoil”)
Example:
In my case I have my airfoil.php script placed as :
MacintoshHD/Users/username/Sites/airfoilremote/airfoil.php
and my path defined in the VD is :
Quoter
esponse, status, errorCode = HC2:GET("/~username/airfoilremote/airfoil.php?cmd_spkr="..pokoj.."&cmd_vol="..suwak);
Note : “LocalSpeaker” is the speaker connected to your Mac.
Example:
In my case I have the following local variables for each slider :
local pokoj = “WIATROLAP"
local pokoj = “LocalSpeaker"
local pokoj = "59-a7”
local pokoj = "POKOJ-3”
local pokoj = “JADALNIA"
local pokoj = “AppleTV"
local pokoj = “ANTRESOLA"
local pokoj = “MIODARNIA"
There are three buttons on Audio Mixer VD :
“Weather Outside” – to send current weather information to TTS system. In my VD it reads information from Netatmo VD.
This should be adjusted to user’s preferences.
User may adjust it to her/his needs at the end when all the rest is up and running.
NOTE: In the code of VD attached it reads the variable from my Netatmo device ID.
It will not work for you without fine tuning.
“Weekday / Time” – to send TTS with the text taken from HC2 system variables
“TTS” – to send TTS with the text taken from global variable “PAMessage”
6.
Place the „airfoil.php” file into you OS X computer. The path for it has to match whatever is defined as the path in your VD
(see example in paragraph 3.)
7.
How to know the IDs of your speakers defined for AirFoil
You have to use Apple Script Editor which is application delivered along with your OS X system. no need to purchase or install anything.
Just use your search bar of OS X system.
You have to write
tell application "Airfoil"get every speakerend tell
into Apple Script Editor.
Here is the screen shot of the OS X script editor which shows you the complete IDs of your Airfoil Speakers.
You can see that part of each ID (after @) matches my local variables for each slider of VD.
8.
Setup Airplay/Chromecast/Bluetoth devices with your Mac
9.
If you want to have other computers to act as clients with speakers install Airfoil Sattelite for each of them. The app is to be downloaded from https://rogueamoeba.com/airfoil/
10.
If you want to have mobile devices to act as clients with speakers install Airfoil Speakers for each of them. The info on these apps can be found on https://rogueamoeba.com/airfoil/
11.
Copy the “Fibaro Text to Speech Bridge v.0.1” application to your Mac computer.
Attached is the zipped file. You have to unzip it to have .app file.
NOTE:
If it happens that HC2 needs to be restarted, it is required to restart “Fibaro Text To Speech Bridge v.0.1”also (Exit and Run).
Restart of “Fibaro Text To Speech Bridge v.0.1” is to be done after HC2 is back operational.
FILES TO DOWNLOAD :
Application for OS X (zipped) -> Fibaro_Text-To-Speech_Bridge_0.1.app.zip
VD for HC2 ------------------------> AUDIO_MIXER_+_TTS.vfib
ICON for VD of HC2 ------------>
AIRFOIL.PHP (zipped) ------>
What's New in Version 1.0.0 See changelog
Released
No changelog available for this version.