Trying to setup something silly for New Years Eve, and I've hit an error I can't seem to process.
Gateway is running on a ubuntu machine.
I'd like to play a sound from the gateway on an event from a perspetive session.
The code I'm using is:
My understanding is this should play a sound on the gateway, however I'm getting error:
Traceback (most recent call last):
File "<input>", line 1, in <module>
ValueError: Unable to open file/url: \srv\ignition\Audio\MySound.wav
I've tried all sorts and cant fathom it out - What am i missing
Thanks!
Edit: Running that code in the script console to try and make it work before integrating into the event
Edit2: The files are on the gateway in that location.
Building on what Transistor mentioned, if you want to test this from the designer, you'll need to configure a gateway message handler that has the playAudioClip call in it, and call that handler via system.util.sendMessage in your script console.
I've changed to a gateway script, and seem to have removed the errors as I see both the 'Trying' and 'Done' in the below script... But no errors and also no sound
Anything else obvious I'm missing?
I've tried a local dir like /home/alex and also a /svr/ dir.
When calling this function from the Gateway scope, the sound will not play unless the operating system has been configured to allow services to play sounds (an uncommon scenario).
Has the Ignition service been configured to allow it to play sounds?
Thanks chaps!
I've checked out the service and its running as my user already with the audio group.
I seem to recall last year I had to make a python OPC server that listened for ignition to write tags and then played sound / midi notes from there. Was hoping to avoid that, but guess it'll be time to dust the script off!
Ill have another crack in the morning.
Thanks for all the help, I'll report back with the final solution when I get there!