Skip to content

jerearaujo03/wifiaudio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WiFi Audio Engine

A high-performance, real-time C++ audio engine designed to capture multi-channel audio from a DAW or interface, create up to 4 custom stereo mixes, and stream them over Wi-Fi with ultra-low latency (< 25ms) using the Opus codec.

This project is built to replace traditional, expensive wired in-ear monitoring systems for musicians on stage.

Features

  • 32-Channel Audio Capture: Uses RtAudio to capture 32 input channels simultaneously in real-time.
  • Lock-Free Processing: Complete lock-free architecture guarantees no audio dropouts or glitches while mixing.
  • Opus UDP Streaming: Encodes the mixes and streams them natively over UDP.
  • Stage Control Web UI: An embedded WebSocket server that powers a sleek, real-time web interface. Musicians can simply open the UI on their phone browsers to perfectly dial in their personal stage mix without needing to download a native app.

1. Prerequisites

To build and run the Audio Engine, you will need:

  • C++17 Compiler (Clang/GCC)
  • CMake (3.5 or higher)
  • Virtual Audio Driver (Optional but recommended): A virtual audio cable like BlackHole (macOS) to route audio directly from your DAW into the engine. For your setup, you would ideally install the 64-channel version of BlackHole.

To install CMake on macOS:

brew install cmake pkg-config

2. Compiling the Project

The project downloads all necessary dependencies (RtAudio, Opus, Asio, WebSocket++, etc.) seamlessly via CMake.

  1. Open your terminal and navigate to the project directory:
    cd /Users/jeremiasaraujo/Documents/repos/wifiaudio
  2. Configure CMake:
    cmake -B build
  3. Build the executables:
    cmake --build build -j8

This will generate two executables in the build/ folder:

  • audio_engine: The main server application.
  • audio_receiver: A simple dummy tester app to decode and play back the Wi-Fi stream.

3. How to Run the System

Step A: Route your Audio

To feed the audio engine, you need to route audio tracks from your DAW.

  1. In your DAW (Logic, Ableton, Reaper, etc.), set your Audio Output Device to your virtual cable (e.g., BlackHole 64ch) or configure your physical Audio Interface's loopback feature.
  2. Ensure you route your individual instruments to discrete channels (1 through 32).
  3. Ensure your sample rate is matching (the engine defaults to 48kHz for optimum Opus latency).

Step B: Start the Audio Engine

Run the newly compiled engine in your terminal:

cd build
./audio_engine

Note: The engine will list the available audio devices it detects on your system, start the WebSocket Control server on port 8080, and begin waiting for audio.

Step C: Open the Stage Control UI

  1. Simply double-click the web/index.html file to open it in your web browser, or navigate to it using: file:///Users/jeremiasaraujo/Documents/repos/wifiaudio/web/index.html
  2. You will see the interface connect instantly (Connected to Audio Engine in green).
  3. Any changes you make to the volume or pan sliders in the 4 mix tabs will be instantly communicated to the C++ core via WebSockets.
  4. To control it from a phone: You can host the index.html file using a simple HTTP server (e.g., python3 -m http.server 8000 inside the web/ folder) and access it via your computer's local Wi-Fi IP address on your phone (e.g., http://192.168.1.100:8000).

Step D: Test the Stream (Audio Receiver)

To verify the engine is successfully pushing sub-25ms Opus encoded streams over your network, you can run the dummy receiver on a separate computer (or locally).

In a new terminal:

cd build
./audio_receiver

The dummy receiver natively listens to UDP port 5000 (Mix 1), decodes the Opus stream, and plays it back through your default system speakers.


Technical Overview

  • src/AudioEngine.cpp: Core callback thread handling real-time audio from RtAudio.
  • src/NetworkStreamer.cpp: Asio-based multi-threaded Opus encoder and UDP packet transmitter.
  • src/ControlServer.cpp: Standalone WebSocket interface interacting securely with the engine parameters (std::atomic).
  • web/index.html: The UI interface. No framework—just high-performance vanilla JS mapping directly to the 4 internal stereo mixes.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors