Skip to content

Sunil-Hegde/AudioSync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This project is under active development!!

AudioSync

A distributed audio system that turns multiple devices into synchronized speakers over WiFi.

Overview

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.

Current Features

  • 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.

Technical Stack

  • Languages: C
  • Audio: FFmpeg, PortAudio, Opus codec
  • Networking: UDP for real-time streaming, custom NTP-like protocol for synchronization

Getting Started

Prerequisites:

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.

Audio File Requirements:

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.raw

Build:

make all

Run:

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:12345 by default
  • On some systems, you may need to run with sudo for network permissions

What this doesn't have and areas of improvement

  • 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.

License

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.

About

AudioSync is a distributed multi device audio system.

Resources

License

Stars

1 star

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors