Train TJBot to Play Sounds in Node-RED

JeanCarl Bisson
2 min readAug 25, 2017

--

Today we’ll train TJBot how to play sounds using the speak node.

Configure the speak node to speak English, enable the speaker, and add the Watson Text to Speech service credentials.

Remember to set the Speaker Device ID to the card and device number of your speaker. Run the command aplay -l to locate this if you have a USB audio adapter or USB speaker connected.

The Raspberry Pi comes with a set of sound files. You can use these or use another audio file you save onto the Raspberry Pi.

Set the payload of the inject node to the path to the audio file to play.

The speak node, when in the play mode, uses the value in msg.payload as the file path to the audio to play. The example above plays a female laugh sound effect.

The second example uses the Cough-male.wav file, which will play a male cough.

Here’s a video of how to train TJBot to play sounds using the speak node

That’s it for today’s skill. What can you train TJBot to do now that it laugh and cough?

Come back tomorrow and we’ll train TJBot to play a game say the color.

This post is part of a series of skills you can train TJBot to perform.

--

--

JeanCarl Bisson

I’m an IBM Technical Innovation Lead. I love to build prototypes and then share how I designed and built what I made so others can try it too.