Skip to content

A simple daemon to play audio on another device's output over the network

License

Notifications You must be signed in to change notification settings

isaac-mcfadyen/audio-stream

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

audio-stream

A simple daemon used to play audio on another computer's output over the network.

Features

  • 🚀 Simple, Rust-based daemon.
  • 💻 Compatible with Linux (PulseAudio/ALSA) and macOS (CoreAudio). Windows untested.
  • 🛜 Low latency (real world testing shows 500-800ms end-to-end).
  • 🔕 Optimizations to reduce bandwidth when no audio is playing.
  • 🔉 Allows any sample rate & buffer size supported by both audio devices.
  • 💻 Integrates live terminal-based stats on audio bandwidth and network latency.

Motivation

I was using Airplay to play audio from my MacBook to a Raspberry Pi connected to a speaker. However, as detailed in this article, Airplay has issues in either Airplay 1 or Airplay 2 mode - one mode causes a large audio delay, and the other encodes audio to 256 kbps AAC. I wanted a solution that was low-latency, lossless, and optimized for LAN streaming.

Installation

First, install Rust if you haven't already.

Then install audio-stream from GitHub:

cargo install --git https://github.com/isaac-mcfadyen/audio-stream

Finally, if you want to stream the audio output from a macOS source device, install Blackhole 2ch and set it as your output in the Audio MIDI Setup application.

Usage

On the receiving side, run audio-stream recv, passing in the device and listen address:

# Example: receiving and outputting via PulseAudio on Linux
# -d = audio device name
# -l = address to listen on (including port)
audio-stream recv -d pulse -l 0.0.0.0:8000

On the sending side, run audio-stream send, passing in the device, address of the receiver, and (optionally) any audio parameters:

# Example: recording and sending audio from Blackhole on macOS
# -d = audio device name
# -a = receiver address (including port)
# -b = buffer size (in frames) - optional, default 2048
# -r = sample rate (in Hz) - optional, default 44100
audio-stream send -d "Blackhole 2ch" -a 192.168.0.10:8000 -r 44100 -b 1024

License

Licensed as MIT. See LICENSE for details.

About

A simple daemon to play audio on another device's output over the network

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages