Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


[VD + APP] Text To Speach (TTS) solution for HC2 and Apple Mac (OS X) - version February 2017 1.0.0

   (0 reviews)

About This File

 

Text To Speach (TTS) solution for HC2 and Apple Mac (OS X) :

mixer_tts-kopia.png

 

 

PREFACE :

It took me two months of tests to make this solution at present stage and I had to learn a little Python and Applescript.

I am aware that lots of details can be improved. However all programmers knows there are no software without bugs and there is never final version. The attached OS X app is fully functional and it is called “Fibaro Airfoil Bridge v.0.1”.

I had no experience with OS X programming. This is the very first OS X app I wrote.

 

 

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. 

 

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) :

Spoiler

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 mappelle 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 mappelle 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.

 

 

 

PLANS FOR FUTURE :

Fine tune the app and improve GUI of Fibaro Airfoil Bridge application.

Enhance the functionality with multiroom audio with distribution music from internet radio and iTunes.

 

This is an open project and I count on your constructive comments.

If there is anybody who would like to be involved in future enhancements please let me know in private message.

 

 

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 Airfoil Bridge  by Marcin S. Milewski (gucio1234) installed on Mac

-        Speakers/audio receivers (any from the list of compatible devices) :

o   Apple AirPlay

o   Google Chromcast

o   Mac , Windows or Linux computer with Airfoil Satellite installed

o   iOS or Android device with Airfoil Speakers installed (if one wants to have TTS on mobile device)

o   Bluetooth

 

The presented solution was tested with the following software versions / hardware :

-        Airfoil for Mac v. 5.5.1

-        Airfoil Sattelite for Windows v.5.1.6

-        OS X v. 10.12.2 (macOS Sierra)

-        Apple AirPort versions A1088, A1264, A1392

-        JBL Flip 3 Bluetooth Speaker

-        Fibaro Airfoil 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 variables in your HC2 (top part of the Variables’ Panel):

                  “PAMessage”  - This variable will store the text you want to convert  to speech.

                  “AudioMixer” – This variable will store the audio mixer settings for the devices.

     2.      

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 two ports:  7000 and 7001.

Define in VD as many audio mixer sliders as you have audio devices to be linked with your multi room audio system. Provide names for each slider corresponding to the devices/rooms you want to control. You may use your local language names, with spaces and local characters.

 

IMPORTANT:

Remember what is the order of your sliders. It is needed in next steps for proper link between HC2 and Mac.

 

 

The LUA code for each slider has to be same but it depends on the number of sliders one has defined. Here are examples :

 

If there are two sliders, LUA definition for each should be :

Spoiler

local AudioMixerLocal = {}

local suwak1 = 9+fibaro:getValue(fibaro:getSelfId(), 'ui.Slider1.value')
suwak1 = (suwak1/10 - suwak1%10/10)/10
AudioMixerLocal[1]=suwak1

local suwak2 = 9+fibaro:getValue(fibaro:getSelfId(), 'ui.Slider2.value')
suwak2 = (suwak2/10 - suwak2%10/10)/10
AudioMixerLocal[2]=suwak2

--Write to global variable "AudioMixer" the required status of audio devices
fibaro:setGlobal("AudioMixer", tostring(json.encode(AudioMixerLocal)))

 

 

If  there are four sliders, LUA definition for each should be :

Spoiler

local AudioMixerLocal = {}
 
local suwak1 = 9+fibaro:getValue(fibaro:getSelfId(), 'ui.Slider1.value')
suwak1 = (suwak1/10 - suwak1%10/10)/10
AudioMixerLocal[1]=suwak1

local suwak2 = 9+fibaro:getValue(fibaro:getSelfId(), 'ui.Slider2.value')
suwak2 = (suwak2/10 - suwak2%10/10)/10
AudioMixerLocal[2]=suwak2

local suwak3 = 9+fibaro:getValue(fibaro:getSelfId(), 'ui.Slider3.value')
suwak3 = (suwak3/10 - suwak3%10/10)/10
AudioMixerLocal[3]=suwak3

local suwak4 = 9+fibaro:getValue(fibaro:getSelfId(), 'ui.Slider4.value')
suwak4 = (suwak4/10 - suwak4%10/10)/10
AudioMixerLocal[4]=suwak4

--Write to global variable "AudioMixer" the required status of audio devices
fibaro:setGlobal("AudioMixer", tostring(json.encode(AudioMixerLocal)))

 

Adjust the LUA code of each slider according to number of sliders there are  in your VD.

 

There are four buttons on Audio Mixer VD (they can be adjusted for user’s preferences ):

 

        “Test Message”       – to send a test message to TTS system. In my VD the predefined test message is in Polish. It should be adjusted to your language.

 

    “TTS”                      – to execute TTS with the text taken from global variable “PAMessage”

 

          “Weather Outside” – to send present weather conditions to TTS system. In my case it is based on global weather variables received from Netatmo weather station. The message is in Polish. It should be adjusted to your local language and preferences.

 

     “Send Data”           – to send audio mixer settings from HC2 to Airfoil without processing any TTS

 

 

Spoiler

Zrzut ekranu 2017-02-02 o 20.26.00.png

 

 

     3.

Test and select desired language/voice for your TTS.

To change text into speech I 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   

 

     4.

Setup Airplay/Chromecast/Bluetoth  devices with your Mac 

 

5.

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/

 

6.

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/

 

 

7.

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 (which I hope will be introduced with future version of my solution)  it is recommended to purchase a license.

 

IMPORTANT:

All the names of the audio devices configured with  Airfoil HAVE TO HAVE names of the speakers without spaces and without any special/national characters. Rename the devices in Airfoil if it is needed.

 

 

Spoiler

AIRFOIL.png

 

 

8.

Copy the “Fibaro Airfoil Bridge v.0.1” application to your Mac computer. DO NOT RUN IT YET.

Attached is the zipped file. You have to unzip it to have .app file.

 

IMPORTANT:

Right click on “Fibaro Airfoil Bridge v.0.1” and select “Show Package Content”

Navigate to   Contents -> Resources

Locate the file “SpeakersNAME.txt”

Edit the file “SpeakersNAME.txt”. Put names of your speakers each in the new line. They have to be same as names defined in Airfoil (paragraph 7.).  The order of the speakers is EXACTLY SAME as order of the sliders of your HC 2 VD “Audio Mixer” (paragraph 2.) .

NOTE: The very first speaker has to be “LocalSpeaker” which is the default speaker of your Mac computer. This has to be defined even if you do not use the speaker of your Mac.

 

Here is an example of “SpeakersNAME.txt” file:

LocalSpeaker
JADALNIA
AppleTV
PC-ANTRESOLA
POKOJ-3
WIATROLAP
MIODARNIA

 

9.

After the “SpeakersNAME.txt” is updated one can run “Fibaro Airfoil Bridge v.0.1” applicaton.

 

mixer_tts-kopia.png

 

 

     NOTE: 

     If it happens that HC2 needs to be restarted, it is required to restart “Fibaro Airfoil Bridge v.0.1”also (Exit and Run).

      Restart of “Fibaro Airfoil Bridge v.0.1” is to be done after HC2 is back operational.

 

 

 

IMPORTANT:

This is known bug with 0.1 version. If you want to close the app use the EXIT button on the main window or the EXIT option of the second pull down menu.

If you close the app with red circle on top left corner of the application’s window or with the QUIT option from the first pull down menu the application is not closed completely. In this case you have to find its icon on the bottom bar of OS X, right click and force close it .

 

 

 


What's New in Version 1.0.0   See changelog

Released

No changelog available for this version.



User Feedback

You may only provide a review once you have downloaded the file.

There are no reviews to display.

×
×
  • Create New...