Author Topic: Gentner Clearone XAP800 detailed setup  (Read 24564 times)

0 Members and 1 Guest are viewing this topic.

Haddood

  • $upporter
  • Hero Member
  • *****
  • Posts: 688
  • Karma: 22
    • View Profile
Gentner Clearone XAP800 detailed setup
« on: January 02, 2015, 06:42:32 PM »
following the steps of Keith in http://voxcommando.com/forum/index.php?topic=1757.0

I am starting this thread to document my setup using Gentner Clearone XAP800, and to discuss obstacles and solutions ...

this should apply to AP400, AP800 and XAP400... these are extremely advanced matrix mixers ... at the time of this post they are flooding ebay .. you can get one from 25$ and up (I saw it for more than 1000)... I believe the reason is that in US, these are being phased out from schools or government setups to be replaced by newer models (according to one reply from ebay seller)...

if you are planning to implement a permanent open-air mic at some point, I highly recommend that you grab one or 2 (depending on how many input signals you need - more on that later) .. boundary mics can be found on ebay for reasonable prices as well (I managed a deal of 4 for 60$ including shipping)... the irony, the various cables I am buying to pass through my apartment are more expensive than the device and the mics   :o :o

the reason I decided to go for these ...
1. those mics are crazy sensitive ... they can hear me whispering from about 10 feet (3m)
2. multiple active mics (up to 8 in XAP 800) + 4 inputs line level on one device. Devices can be chained to get even more !!!
3. adaptive noise cancellation, which is doing great in my initial testing
4. echo cancellation ... make your music, tv, pc ..etc. go through the device and it can filter it out from what it hears through the mic... so VC won't react to speech coming from a speaker ...
5. with 1 or 2 devices and multiple sound cards (depending on number of rooms and stereo or mono signal) these devices can double as audio routers ... meaning VC can send music on sound card 1 to bedroom , and radio on another to kitchen, while watching Blu-ray 5.1 in the living ... or send the music to all rooms ... that applies as well to VC responses ...
status and control ports ... these can be used easily to create control panels around the house to trigger certain setups (scenes) ... those can be routed back to PC through com port
6. and a very important feature, all the features of the device can be controlled through com port by PC
7. gating ... means VC can now the command from which room (although one guy blogged that he disabled this feature, but I believe right configuration can make it work)

« Last Edit: March 22, 2015, 01:57:53 PM by Haddood »
When Voice command gets tough, use hand gestures

Haddood

  • $upporter
  • Hero Member
  • *****
  • Posts: 688
  • Karma: 22
    • View Profile
Re: Gentner Clearone XAP800 detailed setup
« Reply #1 on: January 02, 2015, 06:52:39 PM »
countless thanks to Nime5ter, James and Kalle for their help ...

PY code is now (kind of)  fully functional. it will raise gating event to identify which mic is sending voice stream. this is used to identify the location of the speaker and act accordingly .... as well it can be used to send commands to XAP family products (can be modified to work with AP family easily) ... for the command that sends 0/1/2 for off/on/toggle the script will generate an event confirming the execution of the command and reporting back the new state in case of toggle. for all other commands they will be executed but feedback event is not working or will raise with wrong feedback. this is due to the varying structure and number of parameters to cover all XAP commands ...

attached is sample group that uses the script ...

feedback is always appreciated ...

to setup the system, follow these steps:
Step 1: Jumper the IO port 1 on the back of XAP as following (modify as you see fits, I use this setup because I have 4 mics)
pin 17 ----> pin 1
pin 18 ----> pin 3
pin 19 ----> pin 5
pin 20 ----> pin 7
( i found a 25 D male connector in my computer junk... solders the pins as above)

Step 2: Set up the actions in GPIO builder in G ware
for pin 1, in active low : execute string 0
for pin 3, in active low : execute string 1 ...etc.

Step 3: build the strings in g-ware command strings
for string 0: \nXAP800.Gate&&0&&0\n
for string 1: \nXAP800.Gate&&0&&1\n .... etc. the first payload is the device ID (for future use) and the second payload is the gate ID

if the script loads and establish communication correctly, you should start having Gate events generated whenever a new gate triggered (if the same gate triggered multiple times, only one event will be generated - this is by design, to avoid bombarding VC with events)

Step 4 Setting up gating control
from inputs screen click on each mic "gate" button and set it up as part of group A (or any group) (right part of the image below)
from gating control (the icon with 3 mics) set that group to have Max One mic (Left part of the image below)
this will make sure that VC will listen to only one mic if many people talk at the same time in different rooms

first obstacle; feeding the mic gate status back to VC through com port ...

I managed to feedback by installing jumpers in the back ports ... I Can see the data coming through com port ... but I can't use it in VC
1. installing http://www.eterlogic.com/Products.VSPE.html to give access to the same com port to many programs .. and it gives com port monitor
2. send the info back to VC
     - through com port to UDP tunnel ...
        ideally would be a python script to avoid installing new software and get the possibility to filter the data ... till now this solution causes VC to crush :(


Code: [Select]
#Gentner Serial Communication Script
#version 0.6 will excute all commands but raise event only with queries
#and commands that has 0/1/2 as parameter. Support string feedback if starts
#XAP800.Gate, requires hardware jumpers installed on IO 1
#Based on read/write to serial port by James&Kalle
#you must have enabled the python-plugin in VoxCommando
#start this python script with VoxCommando
#Many thanks for the support from Nime5ter, James and kalle
#without their help this wouldn't be possible
 
import clr
clr.AddReference('System')
from System import *
from System.Collections.Generic import *
import socket

def sendUDP (MESSAGE, UDP_IP, UDP_PORT):
    sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # UDP
    sock.sendto(MESSAGE, (UDP_IP, UDP_PORT))
 
lastData="xyz"
lastCommand="xyz"
 
def  Ondata (sender, event):
    global lastData
    global lastCommand
    sData = sender.ReadLine ()
    #print sData
    if (sData[:11] == "XAP800.Gate")and(sData != lastData):
        lastData = sData
        sendUDP("vc.triggerEvent&&"+lastData, "127.0.0.1", 33000)
    if (len (sData) > 5) and (sData[:3] == "OK>" ):## if length is 5, it is \lOK>\s from previous command
        sData = sData[4:-1] ## trim OK> and \l at the end
        if (len (sData) == len (lastCommand) ) and (sData[:-1]==lastCommand[:-1]): ## this probably a command Response
            sendUDP("VC.TriggerEvent&&XAP800.Response&&"+lastCommand+"&&"+sData[-1:], "127.0.0.1", 33000)
        elif (sData[:len (lastCommand)] == lastCommand ): ## this is probably a query command Response
            sendUDP("VC.TriggerEvent&&XAP800.Response&&"+lastCommand+"&&"+sData[1+len (lastCommand):], "127.0.0.1", 33000)
    if (sData[:5] == "ERROR"):
        sendUDP("VC.TriggerEvent&&XAP800.Error&&"+lastCommand+"&&"+sData[8:], "127.0.0.1", 33000)
       
def XAPcommand(str):
    global lastCommand
    serialPort.WriteLine(str)
    lastCommand = str
 
 
serialPort = IO.Ports.SerialPort("COM1") #set here the serial port connected to XAP800
serialPort.BaudRate = 38400 # default Baudrate for XAP800 38400
serialPort.DataBits = 8
#serialPort.DtrEnable = True
serialPort.RtsEnable = True
serialPort.DataReceived += Ondata
eventPayload=List[str](["COM1",str(serialPort.BaudRate),str(serialPort.DataBits)])
try:
    serialPort.Open()
except:
    vc.triggerEvent("XAP800.Port.Failed",eventPayload)
else:
    vc.triggerEvent("XAP800.Port.Opened",eventPayload)
« Last Edit: March 27, 2015, 01:30:58 AM by Haddood »
When Voice command gets tough, use hand gestures

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Gentner Clearone XAP800 detailed setup
« Reply #2 on: January 03, 2015, 09:14:19 AM »
I'm not too clear on what you are doing here but if we can help you with something specific, let us know.

Haddood

  • $upporter
  • Hero Member
  • *****
  • Posts: 688
  • Karma: 22
    • View Profile
Re: Gentner Clearone XAP800 detailed setup
« Reply #3 on: January 03, 2015, 06:05:45 PM »
James,
I am trying to write a python (the script above) that forwards the com port info to VC through UDP ... but it is not working

to be precise, the UDP part works .. as I see the connection confirmation message in VC ...

to be honest I am not sure if understand the script perfectly, but I believe that
Code: [Select]
serialPort.DataReceived += Ondatais what triggers the monitoring function ...

however no serial data being forwarded to VC

ideally it should filter any character that is below space in ASCII ... hence forwarding only the triggering commands from XAP800 ...
any other solutions, towards the same end, are for sure welcome ...
« Last Edit: January 03, 2015, 06:29:13 PM by Haddood »
When Voice command gets tough, use hand gestures

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Gentner Clearone XAP800 detailed setup
« Reply #4 on: January 03, 2015, 09:13:53 PM »
OK.

What is connected to what com port and what does this virtual serial port emulator have to do with it?  I don't get why you have posted this image of this other program or what information we are supposed to get from it.

What kind of messages are being sent from the serial device?  When are they sent and what is the data that they contain?  Does it follow some kind of protocol?

Why do you need to use UDP?  If you have a python script running inside of VC you can trigger events and any other actions directly.

When you try to execute your python script, does it compile, or is some kind of error shown?

Haddood

  • $upporter
  • Hero Member
  • *****
  • Posts: 688
  • Karma: 22
    • View Profile
Re: Gentner Clearone XAP800 detailed setup
« Reply #5 on: January 03, 2015, 11:24:36 PM »
real com port <--> virtual com port (splitter) <--> XAP800 (running XAP software on PC, to configure and/or monitor XAP800)
                                                                  <--> Python Script <--> VC

the reason for the virtual com port (the software posted above) so that multiple software can connect to the real com port at the same time (through the virtual port) ... otherwise I can't monitor the port by VC and Gentner software at the same time ...
now that screen shot shows that the device is sending the right text data through com port ... so all python has to do is capture that data and send back to VC...

why UDP ... I think it will keep the python script simpler ... the Vc.triggerevent you see in the green text ... those are generated by XAP800 ... so instead of sending a variable to python and translate that with multiple ifs to trigger the right event ... I can trigger the right event straight from within XAP800

now when I run the script posted above I do not get any error messages ... but I don't get to "listen" to any events coming through the com port ...
« Last Edit: January 04, 2015, 12:27:32 AM by Haddood »
When Voice command gets tough, use hand gestures

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2320
  • Karma: 47
    • View Profile
Re: Gentner Clearone XAP800 detailed setup
« Reply #6 on: January 04, 2015, 01:47:17 AM »
If you have the python script already runing, what did the python plugin monitoring?Any data or nothing?
***********  get excited and make things  **********

Haddood

  • $upporter
  • Hero Member
  • *****
  • Posts: 688
  • Karma: 22
    • View Profile
Re: Gentner Clearone XAP800 detailed setup
« Reply #7 on: January 04, 2015, 02:37:37 AM »
Kalle: nothing ...

update ... seems the script is not "opening or initializing the port" ...
the moment I opened the port with a terminal ... the data (seems was in a buffer) flooded VC ...as per image

with the terminal running, VC is receiving the data

update 2
VC continue to receive data even after closing the terminal ... but I must run the terminal once to start receiving data

« Last Edit: January 04, 2015, 03:12:29 AM by Haddood »
When Voice command gets tough, use hand gestures

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Gentner Clearone XAP800 detailed setup
« Reply #8 on: January 04, 2015, 09:56:50 AM »
Why don't you start by connecting the xap directly to the com port and opening it in vc/python without this other program getting in the way? It seems like you are starting with the most complicated possible solution. Start smaller and work your way up to the complicated version. There are too many variables involved right now.

As for your explanation about why you are using UDP I am unfortunately unable to understand your reasoning, but I also don't know where these messages are coming from that already contain TriggerEvent in them.

Haddood

  • $upporter
  • Hero Member
  • *****
  • Posts: 688
  • Karma: 22
    • View Profile
Re: Gentner Clearone XAP800 detailed setup
« Reply #9 on: January 04, 2015, 12:26:53 PM »
James,
I did try to open the com port directly, no luck as well ... And I can't try with terminal and VC at the same time as VC access the port exclusively

The vc.triggerevent messages are generated from the XAP800 hardware ... It has the capacity to send a text string through com port when an event happens... In this case I set it up to send
Vc.triggerevent mic # on/off based on the mic gate status ... Which will inform VC from which room the command is coming ...

Thinking about it ... You are right I can eliminate the UDP part ... Once Python read certain string (ex. Mic # on/off) it triggers an event in VC ... However, that decision will come later once VC can communicate with XAP800

A question comes to my mind, is the script you wrote with Kalle use hardware control with com port ? Or it is written to work over usb to serial with only Tx, Rx and GND Pins?
« Last Edit: January 04, 2015, 12:30:03 PM by Haddood »
When Voice command gets tough, use hand gestures

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Gentner Clearone XAP800 detailed setup
« Reply #10 on: January 04, 2015, 01:21:23 PM »
It has been tested with Arduino which is connected via USB, but I don't think this should really matter.

Is it possible that after you open the serial port, you need to send an instruction to the XAP like some kind of hello message?

Can you try sending a message to the XAP that would cause it to do something which you can visibly see if it is working or not?

Are the messages coming from the XAP terminated with a carriage return?  If not, then maybe readline is not going to work?

Are you sure you have the correct com port, baud, etc?

Haddood

  • $upporter
  • Hero Member
  • *****
  • Posts: 688
  • Karma: 22
    • View Profile
Re: Gentner Clearone XAP800 detailed setup
« Reply #11 on: January 04, 2015, 03:34:46 PM »
James ...
baud rates ..etc. are correct ... as the communication is happening after running terminal  ....

yes the message from XAP is terminated with 0D (hex) character ..

I have a very strong belief that the problem is the way the script opens the port ... (see 2 images)
when VC opens the port RTS (request to send is off) while when terminal open it, it is on triggering the release of the data in the buffer

as well PY serial give the option to set RTS/CTS to True when opening the port (http://pyserial.sourceforge.net/pyserial_api.html)  ...
is that possible with the way the script work ? I can't find documentation
When Voice command gets tough, use hand gestures

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Gentner Clearone XAP800 detailed setup
« Reply #12 on: January 04, 2015, 03:58:51 PM »
http://msdn.microsoft.com/en-us/library/system.io.ports%28v=vs.110%29.aspx

The serial communication aspect is not relying on native Python libraries. Whenever you see the script calling "clr" (Common Language Runtime) and "system", that is your clue that the code is probably using .Net classes.

http://www.ironpython.info/index.php?title=Main_Page
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Gentner Clearone XAP800 detailed setup
« Reply #13 on: January 04, 2015, 04:49:32 PM »
RTS and CTS stand for Request ToSend and Clear To Send respectively.  I don't think you would ever set them both to true.

I'm only guessing here, but I assume that CTS means that we are ready to receive data, this would be the default after opening the port.  RTS would be high when we wanted to send data.  You have not tried to send any data from VC over the serial port but I'm guessing this would set RTS to high automatically.

If you want to mess around with serial port properties you can try looking here:
http://msdn.microsoft.com/en-us/library/System.IO.Ports.SerialPort_properties(v=vs.110).aspx

You can start by setting RtsEnable to True.

e.g.:
Code: [Select]
serialPort = IO.Ports.SerialPort("COM1")
serialPort.BaudRate = 38400
serialPort.RtsEnable = True
serialPort.DataReceived += Ondata
serialPort.Open()

serialPort.WriteLine("something the xap800 can understand")

edit: in my code I had DtrEnable by accident, I changed it to RtsEnable.
« Last Edit: January 04, 2015, 06:19:45 PM by jitterjames »

Haddood

  • $upporter
  • Hero Member
  • *****
  • Posts: 688
  • Karma: 22
    • View Profile
Re: Gentner Clearone XAP800 detailed setup
« Reply #14 on: January 04, 2015, 07:37:36 PM »
Done :)
RtsEnable solved it
When Voice command gets tough, use hand gestures