Author Topic: Setup TTS Server to speak Chinese sentence remotely from Vera  (Read 7263 times)

0 Members and 1 Guest are viewing this topic.

manfaiho

  • Jr. Member
  • **
  • Posts: 47
  • Karma: 0
    • View Profile
Setup TTS Server to speak Chinese sentence remotely from Vera
« on: November 01, 2013, 10:32:40 PM »
Hi brother,

I setup TTS Server using TCP Plugin which allows to receive the string sending from Vera to VOX to speak this sentence using TTS.Speak. I used {1} to capture this string from TCP Server Event. It works perfectly to speak english sentence locally and remotely via TTS Server. When I configure TTS language to non-English (Cantonese), I test it on the action directly using TTS.Speak with Chinese character as parameter. It also works without problem to speak Cantonese sentence. When I put this Cantonese sentence into Vera code to send it remotely to VOX, I found {1} showing "???????????". If I used James' TCP Plugin (for Hexcode manupluation), it will show "\xFG\XEE.......". How can I fix this problem and let VOX can speak Cantonese sentence received from Vera? Thanks.

Vera Code is here:
local socket = require("socket")
host = "192.168.1.12"
c = assert(socket.connect(host, 5555))
c:send("美國洛杉磯國際機場發生槍擊事件")
c:close()



Hi James, we may need your help here ;)

Thanks.

Best regards,
Fai


manfaiho

  • Jr. Member
  • **
  • Posts: 47
  • Karma: 0
    • View Profile
Re: Setup TTS Server to speak Chinese sentence remotely from Vera
« Reply #1 on: November 01, 2013, 10:35:19 PM »
Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<commandGroup open="True" name="TTS" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="304" name="start TCP server" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>TCP.Server.Start</cmdType>
      <cmdString>5555&amp;&amp;TTS_Event</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>VC.Loaded</event>
  </command>
  <command id="316" name="TTS" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>TTS.Speak</cmdType>
      <cmdString>{1}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>TTS_Event</event>
  </command>
  <command id="306" name="Speak Cantonese" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>TTS.Speak</cmdType>
      <cmdString>美國洛杉磯國際機場發生槍擊事件</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
  </command>
</commandGroup>

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Setup TTS Server to speak Chinese sentence remotely from Vera
« Reply #2 on: November 02, 2013, 08:59:13 AM »
Is this the same code twice?  If so, please note that you can edit your posts by clicking the "modify" button, which is next to the "quote" button.
« Last Edit: November 02, 2013, 11:48:40 AM by jitterjames »

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Setup TTS Server to speak Chinese sentence remotely from Vera
« Reply #3 on: November 02, 2013, 10:00:24 AM »
First, create a tcp server that does not use events:
You can then send any kind of action code to this server.  You can also send it events, by sending:  vc.triggerevent&&eventname&&p1&&p2 etc.
This one is using port 2000
Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<command id="262" name="tcp server normal no events" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>TCP.Server.Start</cmdType>
    <cmdString>2000</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
</command>


use this luup code:

Code: [Select]
local socket = require("socket")
host = "192.168.0.107"
c = assert(socket.connect(host, 2000))
c:send("tts.speak&&美國洛杉磯國際機場發生槍擊事件")
c:close()

Make sure you are using the TCP plugin version 0.1.7.1 which I posted in the RFID thread since this dll has not yet been updated in the normal installation of VC.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Setup TTS Server to speak Chinese sentence remotely from Vera
« Reply #4 on: November 02, 2013, 11:47:09 AM »
But I think an important question here is.  "why are you doing it this way?"

What is the big picture here?  What are you trying to accomplish?

It seems to me that usually it would make more sense for VC to be figuring out what to say based on the events that are being generated by Vera.  I am not saying that there is no reason to do what you are doing, just that I am curious what you are doing, because maybe I can suggest a better way.

manfaiho

  • Jr. Member
  • **
  • Posts: 47
  • Karma: 0
    • View Profile
Re: Setup TTS Server to speak Chinese sentence remotely from Vera
« Reply #5 on: November 04, 2013, 08:21:00 AM »
Thanks, James. It works perfectly and resolved my problem. Actually, I setup this TTS Server using TCP Server running on VOX in order to speak any sentence received from TCP client such as Vera. Hence, I found VOX can't speak and recoginze Cantonese.

I actually installed BitVoicer to configre it to recongize Cantonese command then trigger it on VOX over TCP network (using VOX's TCP Server) to control Vera and use TTS to speak the response. (BitVoicer has no respsone or TTS feature) to simulate VOX Cantonese version. I don't know if it is a good solution but at least I can play Cantonese speech recongization with VOX and BitVoicer. In the old day, I used BitVoicer to command it using Arduino to trigger https to control Vera. Now I can use VOX to do the same with a new feature of Cantonese TTS response for each command :-)

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Setup TTS Server to speak Chinese sentence remotely from Vera
« Reply #6 on: November 04, 2013, 09:38:57 AM »
Thanks, James. It works perfectly and resolved my problem. Actually, I setup this TTS Server using TCP Server running on VOX in order to speak any sentence received from TCP client such as Vera. Hence, I found VOX can't speak and recoginze Cantonese.

I understand that you are sending TTS commands from Vera to VC, but my question was "WHY?"  Under what circumstances does it make sense to send TTS from Vera to VC.

In theory VC should be able to recognize Chinese speech commands (simplified or traditional) if windows has the correct language packs installed.  In practice I don't really know how to test this since I really can't speak any Chinese at all.

VC should also be able to perform TTS in any language as long as you have a sapi compatible TTS voice installed for that language.  I'm not sure if Chinese sapi TTS voices are difficult to obtain or not.  It is easy to find them for many other languages although they tend to be a bit expensive.

manfaiho

  • Jr. Member
  • **
  • Posts: 47
  • Karma: 0
    • View Profile
Re: Setup TTS Server to speak Chinese sentence remotely from Vera
« Reply #7 on: November 04, 2013, 10:23:26 AM »
I will use various methods to control Vera such as NFC, Logitect Remote Control, Android Tablet, iPod, Cantonese speech recongiztion using BitVoicer via USB to Arduino. I want to standardize the same voice response on each scene execution in Vera triggered by above methods. That's reason why I need TTS server to handle this from Vera.

For Chinese speech recongization especially for Cantonese language not Marandine language, it is hard to come with voice libary from Microsoft. I can find it from Maradine language when I install language pack and switch the whole UI to this language. I love BitVoicer becasue it don't need to do this OS configuration, just set what speech recongization language within BitVoicer then everything do for you even you are still running English version fo Windows. It should use Speech API to do all what we need within the app. So you see the difference. Yes TTS I can change it if the approriate library is installed that I can do it on Enligh version of Windows but it can speak in Cantonese. But for sppech recognizatio I can't do except I change it to Hong Kong version of Windows totally for VOX.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Setup TTS Server to speak Chinese sentence remotely from Vera
« Reply #8 on: November 04, 2013, 10:40:12 AM »
I was thinking that it would make more sense to use the Vera Scene events to trigger commands with TTS actions in them, but I realized that VC only generates events for Devices, not scenes.  This is probably a feature that I can add to the Vera plugin though.

Quote
But for sppech recognizatio I can't do except I change it to Hong Kong version of Windows totally for VOX.

As far as I know this is not true.

VoxCommando can use any speech engine language that is installed in Windows.  It does not matter what language you use for the windows UI ("display language").  You only need to select the language you want to use in the VoxCommando options.  The number of languages that are available is more limited though (English USA/UK, French, German, Spanish, Japanese, Chinese simplified and Chinese traditional).

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Setup TTS Server to speak Chinese sentence remotely from Vera
« Reply #9 on: November 04, 2013, 11:00:57 AM »
for example

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Setup TTS Server to speak Chinese sentence remotely from Vera
« Reply #10 on: November 04, 2013, 05:03:50 PM »
I got what Windows calls "Standard Chinese" speech recognition to work with VoxCommando without any difficulty.  If I understand correctly this is Mandarin, so if you don't speak Mandarin I guess it does not help you, but here is my test:



Note that I am running Windows with English set as the display language!

manfaiho

  • Jr. Member
  • **
  • Posts: 47
  • Karma: 0
    • View Profile
Re: Setup TTS Server to speak Chinese sentence remotely from Vera
« Reply #11 on: November 04, 2013, 10:05:49 PM »
Hi James,

You are so funny  ;D You can speak in Chinese...wooo....wooo...

Yes, I will try and test it. Possibly I will give up BitVoicer very soon. Actually, Traditional Chinese is not a Cantonese so I need to check how to configure Windows to recognize Cantonese command first. Good start and really appreciate your walkthrough then show us on YouTube. You are so awersome  :biglaugh :biglaugh :biglaugh :biglaugh :biglaugh

Best regards,
Fai