OpenMarine
how to send an audio file to the 'Play audio' node ? - Printable Version

+- OpenMarine (http://forum.openmarine.net)
+-- Forum: OpenPlotter (http://forum.openmarine.net/forumdisplay.php?fid=1)
+--- Forum: Node Red (http://forum.openmarine.net/forumdisplay.php?fid=15)
+--- Thread: how to send an audio file to the 'Play audio' node ? (/showthread.php?tid=621)



how to send an audio file to the 'Play audio' node ? - JD1 - 07-06-2017

I have been experimenting with the 'play audio' node and it works fine to convert text into speech but I have not been able to figure out how to send a .wav or similar audio file to the node. Has anybody done this before ?


RE: how to send an audio file to the 'Play audio' node ? - abarrow - 07-07-2017

I was curious too, so I checked out the description on the NPM site here: https://www.npmjs.com/package/node-red-contrib-play-audio. I couldn't get it to work because I don't have the watson TTS node (and can't install it due to some other install bug that is discussed elsewhere). It appears from looking at the example flow that the payload needs to be changed from msg.payload to msg.speech before it goes into the audio node.

So the assumption is that this node only works for text-to-speech?


RE: how to send an audio file to the 'Play audio' node ? - JD1 - 07-07-2017

Yes, I have seen the same info but am not sure about the Watson TTS node. With TTS presumably standing for Text To Speech, it doesn't seem to fit. There are other nodes available that play audio files and I have the same issue as you in regard to not being able to add nodes (and am watching with great interest for a resolution or work-around)
The play audio node works great for text to speech.


RE: how to send an audio file to the 'Play audio' node ? - abarrow - 07-07-2017

What did you do to get it to work with Text to Speech?

Never mind. I guess I should've just tested it to see what would happen if I injected a string into it. Duhhh.

Seems to work great. I can see it now...
"Approaching Waypoint"
"AIS Target Intercepting Our Course"
"It's happy hour!"


RE: how to send an audio file to the 'Play audio' node ? - JD1 - 07-07-2017

Note that there are two different text to speech nodes - one for the dashboard and one for ... well not the dashboard Smile
I haven't tried out the differences but I believe that if only the dashboard is open and your text to speech node is not the dashboard version, you will not get a sound output.


RE: how to send an audio file to the 'Play audio' node ? - abarrow - 07-07-2017

More testing ... Yes, it does work with WAV files. The big caveat on this node is that you won't hear the audio if the editor window isn't open on your browser.

Try this:
Code:
[
   {
       "id": "aa7ef48e.cf20a8",
       "type": "play audio",
       "z": "def155ce.cb8dc8",
       "name": "",
       "voice": "2",
       "x": 889.9374847412109,
       "y": 772.3333873748779,
       "wires": []
   },
   {
       "id": "8a14d903.578f38",
       "type": "inject",
       "z": "def155ce.cb8dc8",
       "name": "",
       "topic": "",
       "payload": "",
       "payloadType": "date",
       "repeat": "",
       "crontab": "",
       "once": false,
       "x": 337.94447326660156,
       "y": 771.4167175292969,
       "wires": [
           [
               "c24912be.27dd2"
           ]
       ]
   },
   {
       "id": "c24912be.27dd2",
       "type": "file in",
       "z": "def155ce.cb8dc8",
       "name": "",
       "filename": "/usr/share/opencpn/sounds/1bells.wav",
       "format": "",
       "chunk": false,
       "x": 585.9479522705078,
       "y": 865.2535095214844,
       "wires": [
           [
               "aa7ef48e.cf20a8"
           ]
       ]
   }
]



RE: how to send an audio file to the 'Play audio' node ? - JD1 - 07-07-2017

Thank you !!! Yes indeed it works ..... it really helps if you use a file name that is actually on the pi instead of on the computer you use to access the pi .....doooohhhhhh <slaps forehead>