This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to send an audio file to the 'Play audio' node ?
#1
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 ?
  Reply
#2
I was curious too, so I checked out the description on the NPM site here: https://www.npmjs.com/package/node-red-c...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?
  Reply
#3
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.
  Reply
#4
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!"
  Reply
#5
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.
  Reply
#6
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"
           ]
       ]
   }
]
  Reply
#7
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>
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)