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.
- 32-Channel Audio Capture: Uses
RtAudioto 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.
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-configThe project downloads all necessary dependencies (RtAudio, Opus, Asio, WebSocket++, etc.) seamlessly via CMake.
- Open your terminal and navigate to the project directory:
cd /Users/jeremiasaraujo/Documents/repos/wifiaudio - Configure CMake:
cmake -B build
- 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.
To feed the audio engine, you need to route audio tracks from your DAW.
- 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.
- Ensure you route your individual instruments to discrete channels (1 through 32).
- Ensure your sample rate is matching (the engine defaults to 48kHz for optimum Opus latency).
Run the newly compiled engine in your terminal:
cd build
./audio_engineNote: 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.
- Simply double-click the
web/index.htmlfile to open it in your web browser, or navigate to it using:file:///Users/jeremiasaraujo/Documents/repos/wifiaudio/web/index.html - You will see the interface connect instantly (
Connected to Audio Enginein green). - 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.
- To control it from a phone: You can host the
index.htmlfile using a simple HTTP server (e.g.,python3 -m http.server 8000inside theweb/folder) and access it via your computer's local Wi-Fi IP address on your phone (e.g.,http://192.168.1.100:8000).
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_receiverThe dummy receiver natively listens to UDP port 5000 (Mix 1), decodes the Opus stream, and plays it back through your default system speakers.
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.