A distributed audio system that turns multiple devices into synchronized speakers over WiFi.
AudioSync connects computers on the same network to create a DIY surround sound system. The project was inspired by wanting to enhance movie watching experiences without specialized audio equipment. Currently, this project only supports systems with Linux and macOS.
- Connect multiple devices to receive audio
- Stream audio from a host device to connected clients
- Uses UDP multicast for low-latency packet transfer
- Real-time playback synchronization using custom NTP-like protocol
- Uses PortAudio for real-time audio processing and playback
- Multiple users can join the stream mid-way and still stay in-sync.
- Opus audio compression for efficient network transmission.
- Languages: C
- Audio: FFmpeg, PortAudio, Opus codec
- Networking: UDP for real-time streaming, custom NTP-like protocol for synchronization
Before building, ensure you have the required dependencies installed:
PortAudio:
- On Debian/Ubuntu-based systems:
sudo apt-get update sudo apt-get install libportaudio2 libportaudio-dev
- On macOS (using Homebrew):
brew install portaudio opus
Opus Codec:
- On Debian/Ubuntu-based systems:
sudo apt-get install libopus-dev
- On macOS:
brew install opus
For other systems, please refer to the PortAudio documentation and Opus documentation.
The sender currently expects PCM audio files with these specifications:
- Format: 16-bit PCM
- Sample Rate: 48000 Hz
- Channels: 2 (Stereo)
You can convert audio files using FFmpeg:
ffmpeg -i input.mp3 -f s16le -ar 48000 -ac 2 output.rawmake all
Server: ./build/sender input.raw
Client: ./build/receiver
Note: Start the receiver before starting the sender.
On Unix/Linux based systems, use ip addr show to find out sender's ip address.
Important Notes:
- All devices must be on the same network
- Uses multicast group
239.0.0.1:12345by default - On some systems, you may need to run with
sudofor network permissions
- Currently uses a multicast setup, hence volume control or different audio for different devices is not supported. So, this cannot be called truly surrond sound system, but it does the job.
- The setup uses PortAudio for accessing the device's audio backend and implements only linux and macOS compilation in its makefile. Hence, only these two are supported as of now. While porting to windows is easy, building it for android will be significantly tougher since PortAudio doesn't support it officially.
- Currently, audio streaming is only possible from a file, work has to be started to send real-time audio data to facilitate actual speaker extension feature.
Copyright (C) 2025 Sunil Hegde & Mythili Shetty
This project is licensed under the GPL v3 - see the LICENSE file for details. Individual files use SPDX identifiers for clean and concise licensing tracking.