[SOLVED] Ignition text to speech over a radio system

Good morning,

I have a customer that wants the capability to push a button at a work cell and announce a message over a radio system.

Edit 1: I was able to get Ignition to send commands to a 3rd party program espeak and my computer read the text through the speakers. So one possible solution is identifying a radio that can announce a message over audio. After contacting a radio supplier they claim I might be missing some certifications and cause the FCC to “get angry”. I’m not sure if that is a true statement but it’s probably a good idea to investigate further.

Do they already have some sort of radio system in place? If so, what kind?

It is an older system that I don’t have a specific model for but they have a SUB D connector which I could trigger audio to possibly.

Are you going to update the whole system, or use the one they already have in place?

Your SUB D comment makes me think you are using the one already in place. If so, you will need to get specifics on it to find out how it works in more detail.

1 Like

I am not sure what is the best way to proceed. I found a program called eSpeak that appears to convert text to speech (audio) on a computer.

Now I am trying to send commands from Ignition console.

from subprocess import call

call(["espeak","-s140 -ven+18 -z","Hello From Mike"])

Which is giving me a error:

Traceback (most recent call last):
  File "<input>", line 3, in <module>
  File "C:\Users\user\.ignition\cache\gwlocalhost_8043\C0\pylib\subprocess.py", line 502, in call
    return Popen(*popenargs, **kwargs).wait()
  File "C:\Users\user\.ignition\cache\gwlocalhost_8043\C0\pylib\subprocess.py", line 859, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\user\.ignition\cache\gwlocalhost_8043\C0\pylib\subprocess.py", line 1369, in _execute_child
    raise OSError(errno.ENOENT, os.strerror(errno.ENOENT))
OSError: [Errno 2] No such file or directory

Honestly not sure what that has to do with anything.

I don’t have specific experience with this. But there are a lot of variables. I would start with looking into the radio system they have. If that doesn’t go well, I would look into new radio systems that provide such functionality.

You will probably need to fully qualify the path to the espeak executable. Also, make sure it’s available/installed on the gateway. Also, assuming it spits out a file or something, I don’t know how you would deliver that data to the actual radio system.

1 Like

I think if I can get a PC to generate audio on Ignition’s command then I can get things hooked up to a radio…

I can run espeak from a windows 10 command line using this command. I mapped the espeak program to my windows path.

espeak "hello world"

However, when I run these commands from the Ignition console

import system
args = ["cmd.exe", 'espeak "hello world"']
system.util.execute(args)

nothing happens. Any suggestions?

I personally would confirm the how first. I’ve hit many a dead ends before not doing so.

1 Like

Java doesn’t (mostly) care about your system PATH. Fully qualify the executable location.

1 Like

Thanks PGriffith. That was the problem.

import system
args = ['C:\Program Files (x86)\eSpeak\command_line\espeak.exe',  "hello world"]
system.util.execute(args)
1 Like

Actually, just to clarify…

#bad code
import system
args = ["cmd.exe", 'espeak "hello world"']
system.util.execute(args)

This didn’t work because I was trying to run the command line while already in the command line and my second argument should have been 2 separate arguments.

#good code
import system
args = ['C:\Program Files (x86)\eSpeak\command_line\espeak.exe',  "hello world"]
system.util.execute(args)

This one works because of the fully formed path and correct arguments for the espeak program. However, I then ran this code.

#good code because espeak mapped to PATH variable
import system
args = ['espeak.exe',  "hello world"]
system.util.execute(args)

And it also worked because I mapped the program to the windows PATH variable.

3 Likes

Let us know how it goes getting it to the radio system, I’m curious how this will work out.

1 Like

After talking to Motorola they sent us to one of their vendors who then recommended the following:

  1. Software TRBOnet Enterprise Radio Dispatch System
  2. SWIFT A200 (Ethernet to analog output capabilities)
  3. Motorla XPR5550E radio control station

The software TRBOnet can be configured to listen on a port for incoming messages, convert the text to speech, send it out to the SWIFT A200 which has an audio out cable.

run this ignition code to send messages

import socket
import sys

#Server address running TRBOnet listening on port 17341
TCP_IP = '192.168.1.20' 
TCP_PORT = 17341

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((TCP_IP, TCP_PORT))

s.send('put custom message here')

s.close()

The first drawback of this system is you can’t channel steer (change channels programatically).

The second drawback is you have to run Ignition on a separate server because of sockets (I don’t fully understand the problem other than sending messages to 127.0.0.1 fails).

Overall not the most elegant solution mainly due to newer radios not allowing channels to be changed programmatically. Some older Vertex radios have pins you can connect to and change the channel.

1 Like

Thanks for the update.

This can be that the recieving server listens to 192.168.x.x (or what ever ip the server got) and not 0.0.0.0 (all available ip for the server).

1 Like