Node-RED Browser Audio Player

2.5.0 · active · verified Sun Apr 19

The node-red-contrib-play-audio package (current stable version 2.5.0) provides a Node-RED node designed for playing audio directly within the client-side browser context where the Node-RED dashboard or editor is viewed. It specifically leverages the Web Audio API to play raw audio buffers, making it suitable for integrations with other nodes that output audio data, such as Text-to-Speech (TTS) services (e.g., the Watson Text to Speech node). Additionally, it offers basic browser-native Text-to-Speech capabilities for simple string inputs, provided the browser supports this feature. This node is a key component for adding client-side audio feedback or announcements to Node-RED applications, operating exclusively in the browser environment rather than on the Node.js server. Its release cadence follows contributions and updates to Node-RED compatibility.

Common errors

Warnings

Install

Imports

Quickstart

This flow demonstrates installing the node and a basic Text-to-Speech (TTS) example. Install the node via `npm install node-red-contrib-play-audio` in your Node-RED user directory (`~/.node-red`). Then, import this JSON flow, deploy it, and click the 'Trigger TTS' inject node to hear 'Hello from Node-RED!' spoken in your browser.

[
    {
        "id": "a1b2c3d4e5f6g7h8",
        "type": "inject",
        "z": "z9y8x7w6v5u4t3s2",
        "name": "Trigger TTS",
        "props": [
            {
                "p": "payload",
                "v": "Hello from Node-RED!",
                "vt": "str"
            },
            {
                "p": "topic",
                "vt": "msg"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": true,
        "onceDelay": 0.1,
        "topic": "",
        "x": 140,
        "y": 100,
        "wires": [
            [
                "h1g2f3e4d5c6b7a8"
            ]
        ]
    },
    {
        "id": "h1g2f3e4d5c6b7a8",
        "type": "play-audio",
        "z": "z9y8x7w6v5u4t3s2",
        "name": "Play Audio",
        "voice": "default",
        "lang": "en-US",
        "x": 340,
        "y": 100,
        "wires": []
    }
]

view raw JSON →