Skip to main content

audio

Record and play audio via ALSA for voice alerts, monitoring, and sound detection.

Overview

The audio node provides audio recording and playback capabilities through ALSA (Advanced Linux Sound Architecture). Use it to record voice memos, play alert sounds, detect available audio devices, and control system volume on your Raspberry Pi or Linux device.

48kHz
Max Sample Rate
4
Operations
ALSA
Audio Backend
32-bit
Max Bit Depth

Properties

Property Type Default Description
operation select "detect" Operation: "record", "play", "detect", or "volume"
device string "default" ALSA device name (e.g., "hw:0,0", "plughw:1,0")
format select "wav" Audio format: "wav" or "raw"
sampleRate select "44100" Sample rate: "8000", "16000", "22050", "44100", or "48000"
channels select "1" Audio channels: "1" (mono) or "2" (stereo)
bitDepth select "16" Bit depth: "8", "16", "24", or "32"
duration number 5 Recording duration in seconds
volume number 75 Playback volume percentage (0-100)
outputDir string "/tmp/edgeflow-audio" Directory to save recorded audio files

Inputs

msg.payload

Any incoming message triggers the configured operation. Override settings via payload properties.

{
  "payload": {
    "operation": "record",
    "duration": 10,
    "sampleRate": "16000"
  }
}

Outputs

Record Output
{
  "payload": {
    "filepath": "/tmp/edgeflow-audio/rec_001.wav",
    "duration": 5,
    "format": "wav",
    "sampleRate": 44100,
    "channels": 1
  }
}
Play Output
{
  "payload": {
    "status": "complete",
    "filepath": "/home/pi/alerts/alarm.wav",
    "volume": 75
  }
}
Detect Output
{
  "payload": {
    "devices": [
      { "id": "hw:0,0", "name": "bcm2835 Headphones" },
      { "id": "hw:1,0", "name": "USB Audio Device" }
    ]
  }
}
Volume Output
{
  "payload": {
    "volume": 80,
    "device": "default"
  }
}

Example Flows

Temperature Alert with Audio Warning

Play an alarm sound when temperature exceeds threshold.

[
  {
    "id": "temp-sensor",
    "type": "dht22",
    "pin": 4,
    "interval": 5
  },
  {
    "id": "check-temp",
    "type": "switch",
    "property": "payload.temperature",
    "rules": [
      { "t": "gt", "v": "35" }
    ]
  },
  {
    "id": "set-alarm",
    "type": "change",
    "rules": [
      { "t": "set", "p": "payload.filepath", "to": "/home/pi/sounds/alarm.wav" }
    ]
  },
  {
    "id": "play-alarm",
    "type": "audio",
    "operation": "play",
    "volume": 90
  }
]

Scheduled Audio Monitoring

Record 30-second audio clips every 10 minutes for environmental monitoring.

[
  {
    "id": "schedule",
    "type": "inject",
    "repeat": "600",
    "payload": ""
  },
  {
    "id": "record-audio",
    "type": "audio",
    "operation": "record",
    "duration": 30,
    "sampleRate": "16000",
    "channels": "1",
    "format": "wav",
    "outputDir": "/home/pi/audio-logs"
  },
  {
    "id": "log-result",
    "type": "debug",
    "name": "Audio Recorded"
  }
]

List Available Audio Devices

Scan and display all ALSA-compatible audio devices on the system.

[
  {
    "id": "scan-trigger",
    "type": "inject",
    "payload": "",
    "once": true
  },
  {
    "id": "detect-devices",
    "type": "audio",
    "operation": "detect"
  },
  {
    "id": "show-devices",
    "type": "ui-table",
    "name": "Audio Devices"
  }
]

Common Use Cases

Voice Alerts

Play pre-recorded warnings when sensors detect anomalies or thresholds are exceeded.

Environmental Monitoring

Record ambient sound for wildlife tracking, noise level analysis, or acoustic sensing.

Intercom System

Build a two-way intercom by combining record and play operations across devices.

Doorbell & Notifications

Trigger audio chimes from button presses, MQTT messages, or webhook events.

Related Nodes