# How to play a sound?

**URL:** <https://discourse.nodered.org/t/how-to-play-a-sound/14509>\
**Category:** General\
**Created:** [19 August 2019 23:28 UTC](https://discourse.nodered.org/t/how-to-play-a-sound/14509 "2019-08-19T23:28:26Z")\
**Posts on this page:** 5\
**Page:** 2

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [21 August 2019 10:35 UTC](https://discourse.nodered.org/t/how-to-play-a-sound/14509/21 "2019-08-21T10:35:21Z")

</div>

Can you just confirm that you did indicate that using /dev/dsp _does_ work from node-red?

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [21 August 2019 10:40 UTC](https://discourse.nodered.org/t/how-to-play-a-sound/14509/22 "2019-08-21T10:40:46Z")

</div>

When I ran the command back in #14 it fails.

I didn't do it in NR because there is no command to play the file.

Post #10 shows both versions of the command work/play the sound.

So, sorry, what is the command you want me to do in NR?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [21 August 2019 10:45 UTC](https://discourse.nodered.org/t/how-to-play-a-sound/14509/23 "2019-08-21T10:45:59Z")

</div>

You showed the output for  
`mpg123 -a /dev/audio /home/me/.node-red/public/Sounds/Bell-ding-loud.mp3`  
which did not work.  
I said

> [@Colin](#):
>
> So /dev/audio doesn't exist on your system. Try /dev/dsp

and you said

> [@Trying\_to\_learn](#):
>
> Yeah, ok, but if I just do the command:  
> `mpg123 (sound file)` it works.  
> I showed that.
> 
> Can you explain why the `/dev/dsp` is needed?

I took "Yeah, ok" to mean that it worked with /dev/dsp, and you were asking why you needed to use /dev/dsp. Was I naive in taking that meaning from your words?

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [21 August 2019 10:59 UTC](https://discourse.nodered.org/t/how-to-play-a-sound/14509/24 "2019-08-21T10:59:36Z")

</div>

Sorry.

Miss-communication.

I wanted to know why it was needed. Subsequently when I went down the `ls -l /dev/dsp*` and got an error, it was understood by me that as that gave an error, it seemed academic.

However, if I make the command:  
`mpg123 -a /dev/dsp /home/me/.node-red/public/Sounds/Bell-ding-loud.mp3`

I see this (just a few of the messages)

`Cannot connect to server socket err = No such file or directoryCannot connect to server request channel`

`JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlockJackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock`

`Unknown PCM cards.pcm.center_lfe ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side`

`ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map`

(No sound was heard.)  
I think that it doesn't work.

---

<div class="post-metadata">

**Author:** ![m4rten](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/m4rten/32/63353_2.png) [@m4rten](https://discourse.nodered.org/u/m4rten)\
**Post date:** [19 April 2020 15:46 UTC](https://discourse.nodered.org/t/how-to-play-a-sound/14509/25 "2020-04-19T15:46:43Z")

</div>

If you still got the problem, build up an ssh connection to your machine, which got the hdmi. Then try the commands that work in your terminal to push them via ssh.

For example a current solution for me is:  
i installed sshpass.then you can run a command on the machine with the hdmi following command:

sshpass -p 'password' ssh -o StrictHostKeyChecking=no user@host 'command'

it should play like you are sending the command via putty or anything else

[Previous page](https://discourse.nodered.org/t/how-to-play-a-sound/14509.md?page=1)
