首页 > 解决方案 > 我无法使用 node-red 中的“exec”节点播放任何声音

问题描述

我无法使用 node-red 的“exec”节点播放任何声音,尽管通过 raspberry pi 命令行它可以使用相同的命令:

 aplay -D default /home/pi/.node-red/public/Cuckoo-sound-effect.wav

甚至节点红色的输出也是一样的:

播放 WAVE '/home/pi/.node-red/public/Cuckoo-sound-effect.wav' :有符号 16 位 Little Endian,速率 44100 Hz,立体声

这是实现的流程:

[{"id":"ef757da2.68916","type":"exec","z":"83beb11f.6c8ed","command":"aplay","addpay":true,"append":"-D default","useSpawn":"","timer":"","oldrc":false,"name":"aplay","x":290,"y":2520,"wires":[["bfe7b588.f58108"],["2632e1b.090841e"],[]]},{"id":"bfe7b588.f58108","type":"debug","z":"83beb11f.6c8ed","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":510,"y":2480,"wires":[]},{"id":"d3481977.0432e8","type":"inject","z":"83beb11f.6c8ed","name":"","topic":"","payload":"/home/pi/.node-red/public/Cuckoo-sound-effect.wav","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":"","x":110,"y":2520,"wires":[["ef757da2.68916"]]},{"id":"2632e1b.090841e","type":"debug","z":"83beb11f.6c8ed","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":510,"y":2520,"wires":[]}]

谁能指出我做错了什么?非常感谢 !!

标签: node-red

解决方案


在 2021 年,Node-Red 2.x 有节点可以在本地和仪表板上播放 (mp3 + wav) 音频文件。
所以也许不再需要 exec 了。

在此处输入图像描述


推荐阅读