Skip to content
forked from afaden/babelpod

Add line-in and Bluetooth input to the HomePod (or other AirPlay speakers); intended to run on Raspberry Pi.

License

Notifications You must be signed in to change notification settings

gsperry/babelpod

 
 

Repository files navigation

BabelPod

A modern audio routing system that connects various inputs (Line-in, Bluetooth, PCM) to different outputs (AirPlay speakers including HomePod, Bluetooth devices, PCM outputs). Built with cross-platform support and a modern React frontend.

Features

Audio Routing

  • Multiple Input Types:
    • Line-in audio sources
    • Bluetooth devices
    • PCM audio devices
    • Virtual/void devices
  • Multiple Output Types:
    • AirPlay speakers (including HomePod)
    • Bluetooth audio devices
    • PCM audio outputs
    • Multiple simultaneous outputs

Modern Interface

  • Real-time device discovery and connection
  • Individual volume controls per device
  • Device grouping support
  • Audio preset support
  • Dark mode interface optimized for touch screens
  • Responsive design
  • Real-time status updates

Technical Features

  • Cross-platform support (Linux and macOS)
  • Native audio integration
  • Low latency audio routing
  • Automatic device discovery
  • Graceful fallbacks for unsupported features
  • TypeScript throughout
  • Modern React patterns
  • Socket.IO for real-time updates

Prerequisites

For Raspberry Pi (Raspbian):

  1. Install required packages:
# Audio and Bluetooth dependencies
sudo apt-get update
sudo apt-get install -y bluez pulseaudio-module-bluetooth
sudo apt-get install -y libasound2-dev avahi-daemon
  1. Configure Bluetooth service permissions:
# Create a new policy file
sudo nano /etc/polkit-1/localauthority/50-local.d/46-allow-bluetooth-service.pkla

Add this content:

[Allow users to manage bluetooth service]
Identity=unix-group:bluetooth
Action=org.freedesktop.systemd1.manage-units;org.freedesktop.systemd1.manage-unit-files
ResultAny=yes
ResultInactive=yes
ResultActive=yes
  1. Set up user permissions:
# Create bluetooth group and add your user
sudo usermod -aG bluetooth $USER

# Add user to audio group
sudo usermod -aG audio $USER
  1. Configure Bluetooth settings:
sudo nano /etc/bluetooth/main.conf

Add these lines:

[Policy]
AutoEnable=true

[General]
ControllerMode = bredr
  1. Apply changes:
# Restart Bluetooth service
sudo systemctl restart bluetooth

# Reboot to apply all changes
sudo reboot

For Other Linux Distributions:

  1. Install required packages:
# Audio and Bluetooth dependencies
sudo apt-get install bluez pulseaudio-module-bluetooth
sudo apt-get install libasound2-dev avahi-daemon
  1. Configure Bluetooth permissions:
# Create a new polkit rule file
sudo nano /etc/polkit-1/rules.d/51-bluetooth.rules

Add this content:

polkit.addRule(function(action, subject) {
    if ((action.id == "org.bluez.device.pair" ||
         action.id == "org.bluez.device.connect" ||
         action.id == "org.bluez.device.disconnect" ||
         action.id == "org.bluez.adapter.discoverable" ||
         action.id == "org.bluez.adapter.bondable" ||
         action.id == "org.bluez.adapter.blocked") &&
        subject.local && subject.active && subject.isInGroup("bluetooth")) {
            return polkit.Result.YES;
    }
});
  1. Set up user permissions:
# Create bluetooth group and add your user
sudo groupadd -f bluetooth
sudo usermod -aG bluetooth $USER

# Add user to audio group
sudo usermod -aG audio $USER
  1. Configure Bluetooth settings:
sudo nano /etc/bluetooth/main.conf

Add these lines:

[Policy]
AutoEnable=true

[General]
ControllerMode = bredr
  1. Apply changes:
# Restart Bluetooth service
sudo systemctl restart bluetooth

# Log out and log back in for group changes to take effect

For macOS:

# Install required utilities
brew install blueutil switchaudio-osx sox

Installation

  1. Clone the repository:
git clone https://github.com/gsperry/babelpod.git
cd babelpod
  1. Install Node.js dependencies:
npm install
  1. Build the application:
npm run build
  1. Start the server:
npm start

The web interface will be available at http://localhost:3000

Development

To run in development mode with hot reloading:

npm run dev

This will start both the backend server and frontend development server.

Architecture

Frontend

  • React with TypeScript
  • Tailwind CSS for styling
  • Socket.IO for real-time communication
  • shadcn/ui for component library

Backend

  • Node.js with Express
  • Socket.IO for real-time communication
  • Platform-specific audio integrations:
    • Linux: ALSA, PulseAudio, BlueZ
    • macOS: CoreAudio, BlueUtil

Audio Routing

  • AirPlay: node_airtunes2
  • PCM: Platform-specific implementations
  • Bluetooth: Platform-specific implementations with fallbacks

Platform Support

Linux

  • Full support for all features
  • Uses native ALSA and PulseAudio
  • D-Bus for Bluetooth (with command-line fallback)
  • AirPlay support via node_airtunes2

macOS

  • AirPlay support
  • Native Bluetooth support
  • CoreAudio integration
  • Some features may require additional permissions

Contributing

Contributions are welcome! Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.

Authors

  • Guy Sperry - Modern rewrite, Bluetooth support, cross-platform compatibility
  • Andrew Faden - Original creator

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Acknowledgments

Screenshots

BabelPod Interface

About

Add line-in and Bluetooth input to the HomePod (or other AirPlay speakers); intended to run on Raspberry Pi.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 96.2%
  • JavaScript 1.8%
  • CSS 1.7%
  • HTML 0.3%