Project Overview

SyncSonic is a custom-built, low-latency audio distribution system for Raspberry Pi that allows any smartphone to become a powerful multi-speaker controller. It uses a combination of Linux audio tools (PulseAudio), the BlueZ Bluetooth stack, and a custom BLE (Bluetooth Low Energy) service to connect and control a fleet of Bluetooth speakers in real time. The system now uses PipeWire as the primary audio transport layer for improved latency calibration and device management. PulseAudio is maintained as a compatibility layer.

Demo Video

How It Works

SyncSonic is deployed on a Raspberry Pi connected to multiple USB Bluetooth adapters. The backend service is written entirely in Python and coordinates all device activity through a finely tuned architecture:

  • Custom BLE GATT Protocol: The Pi advertises a BLE characteristic that enables a mobile app to send JSON-encoded commands (e.g., connect/disconnect, set volume, mute, scan for devices). All communication is handled through a single R/W/Notify GATT characteristic.
  • State Machine for Each Speaker: Each Bluetooth speaker follows a deterministic FSM to ensure proper sequencing of discovery, pairing, trust, connection, and audio loopback setup. The system supports real-time reconnection and handles transient failures automatically.
  • PipeWire and PulseAudio Loopbacks: The system now uses PipeWire as the primary audio transport layer for improved latency calibration and device management. PulseAudio is maintained as a compatibility layer, with a central virtual_out sink and per-device module-loopback instances for adjustable latency and volume.
  • Microphone-Based Synchronization at Startup: At initialization, the system uses a microphone input and an muting sequence paired with audio cross-correlation to measure and synchronize speaker startup timing. This eliminates phase differences before playback begins.
  • Upcoming: Real-Time Drift Correction via High-Frequency Bursts: To maintain synchronization during playback without interrupting listening, a planned update will use inaudible high-frequency bursts. The system will periodically transmit these bursts to all speakers, measure cross-correlation in real time, and apply micro-adjustments to prevent drift. Feasibility has been experimentally validated.
  • BLE Notifications: Live status updates are pushed from the Pi to the mobile app using BLE notifications, keeping the user informed of connection phases and results.

Mobile App Integration

The mobile application connects to the Pi over BLE and allows users to:

The app includes a Tamagui-powered dark/light theme system and persists local speaker configuration through Expo SQLite.

  • Scan and Select Speakers: Dynamically detect available Bluetooth devices and initiate connections
  • Group Speakers: Create and manage audio groups for synchronized playback
  • Adjust Audio Settings: Fine-tune latency, master volume, and left/right balance for each speaker
  • Mute and Unmute: Toggle mute state on a per-device basis

Frontend Architecture

The SyncSonic mobile application is built using React Native with Expo, featuring a modern, responsive UI that adapts to both light and dark themes. The frontend is designed with a focus on user experience and real-time device management.

Technology Stack

React Native Expo Tamagui Expo Router React Native BLE PLX Expo SQLite React Native Reanimated Lottie

User Interface Components

  • Navigation System: Custom TopBar and TopBarStart components for consistent navigation, theme-aware logo implementation with dark/light variants, and responsive layout adapting to iOS and Android platforms
  • Theme System: Dynamic theme switching between light and dark modes with custom color palettes (Light theme: Purple-based #3E0094 with light backgrounds #F2E8FF, Dark theme: Pink-based #E8004D with dark backgrounds #250047) and consistent typography using Finlandica and Inter font families
  • Core Features: Comprehensive device management interface, audio control system, and configuration management tools
  • User Experience Elements: Loading animations, connection status overlays, error handling, gesture-based controls, and haptic feedback

State Management & Data Persistence

  • State Management: BLE Context for Bluetooth communication, Theme Context for UI theme switching, Configuration State for speaker groups and settings, and Connection State for device status tracking
  • Data Persistence: SQLite database for storing speaker configurations, connection history, user preferences, and device groupings

Responsive Design

  • Adapts to different screen sizes and orientations
  • Platform-specific adjustments for iOS and Android
  • Safe area handling for notches and system bars
  • Dynamic layout adjustments based on device orientation

Technical Architecture

Python PipeWire PulseAudio BlueZ BLE GATT Raspberry Pi Linux D-Bus NumPy SciPy soco

System Highlights

  • Multi-Adapter Management: Utilizes USB Bluetooth dongles in parallel, with one reserved for BLE communication and others for audio streaming
  • Thread-Safe and Modular: Discovery, connection orchestration, and D-Bus operations are managed through synchronized worker queues
  • Resilient Startup and Operation: Designed for hands-free operation via systemd with automatic environment initialization

Current Status

The prototype successfully streams synchronized audio to multiple Bluetooth speakers (5+ when including Wi-Fi speaker integration) from any brand, with live control via the mobile app. Startup synchronization uses microphone-based cross-correlation for phase alignment. Extensively tested with real-time audio sources (Spotify, local media). Operators use it daily in personal deployment.

Next Steps

The current prototype proves that seamless, synchronized Bluetooth audio playback is possible using commodity hardware. The next phase of the project is to transition from the Raspberry Pi to a custom hardware platform designed specifically for this use case. I am actively seeking funding to develop a compact, cost-effective board that integrates a Linux-capable processor with multiple directly wired Bluetooth chips—eliminating the need for USB dongles and reducing latency, power consumption, and physical complexity.

This purpose-built device will serve as a plug-and-play Bluetooth audio hub, enabling consumer-friendly deployment in homes, outdoor events, shared spaces, and more. The mobile app and backend software are already production-ready and will be fully compatible with the new hardware. With funding, I aim to take SyncSonic from prototype to polished product.