Direct Gemini Live Integrator

Next-Gen Voice-Controlled
Media System

A high-performance C++ firmware, lightweight Go command proxy, and Svelte 5 control interface combined into a single real-time voice-assistant media player ecosystem.

Explore Projects View Architecture

Ecosystem Projects

Nexus is split into three decoupled components that communicate seamlessly using WebSockets, JSON-RPC, and MQTT.

ESP32-S3 Hardware Client

Ultra-low latency, real-time edge processing

Runs on the Waveshare Audio Development Board. It processes audio input and output locally, maintains a secure WebSocket session directly to Google's Gemini Live API, coordinates hardware states, and responds to local physical buttons.

Core Technologies

C++17 ESP-IDF v5.x FreeRTOS WakeNet / ESP-SR I2S DMA EmbeddedSysDb

Key Architectural Strengths

  • Direct Gemini Live Connection
  • EmbeddedSysDb (State Reactor)
  • WakeNet Local Wake Word
  • Linear Resampler (3:4 & 3:2)
EmbeddedSysDb.cpp
// Lock-free state modification
void updateVolume(int new_vol) {
    EmbeddedSysDb::getInstance().mutate([new_vol](SystemState& s) {
        s.audio.speaker_volume = new_vol;
    });
    // Tasks registered to COMP::AUDIO receive 
    // synchronous FreeRTOS task notifications
}

Go MPV Relay Backend

Robust media coordination & stream resolution

Acts as the central coordination agent. It runs on a local machine or home server, receiving MQTT messages from the ESP32 or WebSocket packages from the web dashboard. It dynamically fetches media links from YouTube via `yt-dlp`, plays them via `mpv`, tracks local play queues, and stores offline tracks in an SQLite database.

Core Technologies

Go 1.25 mpv Daemon yt-dlp Gorilla WebSockets SQLite (Pure Go) HiveMQ MQTT

Key Architectural Strengths

  • Panic-Safe Async Command Routing
  • Real-time Stream-Record Caching
  • Intelligent Audio Ducking
  • CGO-free cross-compilation
queue.go
// Intercept voice events to duck music
func (q *Queue) HandleAssistantState(state string) {
    switch state {
    case "pause":
        q.wasPlaying = q.mpv.IsPlaying()
        q.mpv.Pause()
    case "play":
        if q.wasPlaying {
            q.mpv.Resume()
        }
    }
}

Svelte 5 Web Dashboard

Beautiful, reactive user dashboard

A fast, reactive web interface built with Svelte 5 and Tailwind CSS v4. It monitors the MPV server state in real time, displays playback information, hosts a debug WebSocket message console, and provides UI controls to remotely update the ESP32 configuration.

Core Technologies

Svelte 5 Tailwind CSS v4 Vite HTML5 WebSockets Svelte Runes

Key Architectural Strengths

  • Real-time State Synchronization
  • Full Playback Controller
  • Remote Settings Editor
  • Live Console Frame Log
store.svelte.js
// Svelte 5 reactive stores using Runes
export class MpvStore {
    playbackState = $state({ title: "", volume: 100 });

    update(data) {
        this.playbackState.title = data.title;
        this.playbackState.volume = data.volume;
    }
}

Ecosystem Dataflow

See how the entire system reacts when you say a voice command, streaming audio and instructions seamlessly in milliseconds.

ESP32 Edge

1. Wake & Capture

WakeNet wakes up board. AudioService captures mic stream and pumps it to the WebSocket.

Google Cloud

2. Gemini Live

Decodes voice stream, matches tool calling schemas, and returns structured function call JSON.

Go Backend

3. Stream Resolver

Receives tool call over MQTT/CMD, queries yt-dlp, and loads resolved stream URL to mpv socket.

Svelte WebUI

4. State Update

Go server publishes play state over WebSockets, updating the user dashboard instantly.

Key Ecosystem Solutions

Advanced engineering implementations resolving audio streaming, synchronization, and configuration problems across the projects.

Dynamic Resampling & Leaky Playback

The ESP32 firmware dynamically handles linear upsampling (24kHz assistant to 32kHz native DAC) and downsampling (32kHz mic to 16kHz VAD/WakeNet), using a leaky bucket algorithm to prevent buffer starvation.

ESP32-S3 Firmware

Real-time Stream Caching

The Go Backend instructs `mpv` to log played network stream packets directly to disk (using `stream-record`). This caches music transparently as you listen, ensuring no bandwidth is wasted on repeat tracks.

Go Backend mpv

Device Configuration Bridge

Enables absolute administrative control. Svelte clients edit and write the ESP32 SD card's settings via custom JSON WebSocket commands that the Go backend translates to targeted MQTT packets.

ESP32 Firmware Go Backend Svelte UI