# Node "Play Audio" and "Text-to-Speech" on a Raspberry Pi

**URL:** https://discourse.nodered.org/t/node-play-audio-and-text-to-speech-on-a-raspberry-pi/40401
**Category:** General
**Created:** [4 February 2021 21:18 UTC](https://discourse.nodered.org/t/node-play-audio-and-text-to-speech-on-a-raspberry-pi/40401 "2021-02-04T21:18:38Z")
**Posts on this page:** 1
**Showing post:** 6

<div class="post-metadata">

### Author: ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)
#### Post date: [28 October 2021 13:41 UTC](https://discourse.nodered.org/t/node-play-audio-and-text-to-speech-on-a-raspberry-pi/40401/6 "2021-10-28T13:41:53Z")

</div>

Just for information for others who want to use this on older Pi hardware

If you go thru normal installation process and end up with an error showing in the pico2wave node - you'll need to compile it.

Unfortunately, the compilations instructions don't quite work and you need to install further dependencies

So before following the compilation instructions do this (this is from going back thru my bash history so I hope I haven't missed anything off!)

```auto
sudo apt-get install autotools-dev
sudo apt-get install libtool
sudo apt-get install libpopt-dev

```

I then git cloned the repository so that I had a new folder  
/home/pi/picotts  
and then cd to pico and ran the compile instructions from there

Unfortunately, the last of the instructions on the GitHub site say  
`make install`  
but this didn't work for me  
neither did  
`sudo make install`  
(The sudo one appears to do the job but I still got an illegal instruction error if i ran pico2wave)

However, there is a working pico2wave in /home/pi/picotts/pico

At this point, my Linux skills ran out so to make the node use the new compiled version I manually edited  
`/home/pi/.node-red/node-modules/node-red-contrib-pico2wave/pico2wave.js`

and replaced line 65  
`node.pico2waveCommand = "pico2wave -w " + node.filePath + " -l " + node.language;`  
with

`node.pico2waveCommand = "/home/pi/picotts/pico/pico2wave -w " + node.filePath + " -l " + node.language;`

and restarted Node-RED and it all worked

It was a LOT of faffing around but it lets me use an old Pi to act as a standalone text to speech device to issue commands to my Alexa dot 🙂

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/8/e86999ae15eb8fe6e9b38c1e7687e101b98e0ed1.png)

Note on how to hear it when running Node-RED as a service

> [@\[SOLVED\]Not hearing sound using aplay via exec when running as service](https://discourse.nodered.org/t/solved-not-hearing-sound-using-aplay-via-exec-when-running-as-service/52924):
>
> Following on from how to get Node-RED to run as a service on a Pi I'm having trouble playing a sound via exec node So I'm trying to play a wav file out thru the Pi audio jack It works fine when I run Node-RED directly from a terminal As I was typing this I suddenly thought that the sound is probably defaulting to going out thru HDMI and with a bit of googling and experimenting I came up with this as my solution [image] which tells it to explicitly use the audio jack and all good …

---

_[View the full topic](https://discourse.nodered.org/t/node-play-audio-and-text-to-speech-on-a-raspberry-pi/40401)._
