Skip to content

Repository files navigation

OpenAmadeus Companion

A full-stack, modular trilingual (Japanese / English / Brazilian Portuguese) multimodal conversational AI runtime inspired by the Amadeus System from Steins;Gate 0. It features interactive visual novel sprite animations (with a copyright-safe procedural holographic silhouette fallback), F1/F2 spectral formant lip-sync, Silero neural VAD, real-time HTML5 Canvas oscilloscope telemetry, ultra-low-latency neural voice cloning (Kurisu Qwen3-TTS Multilingual with CUDA Graphs, Kokoro-TTS 82M, Microsoft Edge-TTS, and Kurisu RVC v2), Dynamic Few-Shot Retrieval-Augmented Generation (RAG), and fault-tolerant multi-provider LLM orchestration.

Version License: GPL v3 TypeScript React FastAPI Python Qwen3-TTS Faster-Qwen3-TTS Silero VAD Kokoro-TTS Kurisu-RVC ChromaDB Docker

πŸ“Έ Interface & Demonstrations

Conversational HUD & Active Sprite Immersive Japanese Visual Novel Call Mode
Chat Interface - Workbench HUD
Workbench HUD showing decoupled UI & Conversation languages (UI: EN / TALK: PT / JP VOICE), Silero VAD badge, and audio-reactive Kurisu sprite
Visual Novel Call Mode (JA)
Full-screen Visual Novel call mode in Japanese (UI: JA / ε―Ύθ©±: JA) with Silero VAD listening and canonical dialogue cadence
Cortex & Trilingual Synaptic Inspector (JA / EN / PT) Multilingual Voice & Neural TTS Settings
Cortex & Synaptic Inspector
Japanese UI Synaptic Inspector displaying ChromaDB vector memories with trilingual JA/EN/PT retrieval tags and SQLite session counts
System Settings Modal
Independent Interface vs. Conversation language controls, Japanese Voice + Translated Subtitles toggle, and Qwen3-TTS 1.7B streaming

Cortex LLM Credentials & Impatience Telemetry
Cortex Configuration Modal β€” Multi-provider LLM routing (Groq, Gemini, OpenRouter), strict model pinning, and 2-stage contextual impatience telemetry.

πŸ”¬ Overview

OpenAmadeus Companion (lucca3447/OpenAmadeus) recreates the digitalized persona and consciousness of the neuroscientist character Makise Kurisu using strict natural language system directives, episodic semantic memory retrieval, and synchronized audiovisual rendering.

Core Highlights

  • 4-Stage Universal Voice Engine Cascade (server/app/services/voice_service.py):
  • Real-Time PCM16 Streaming & Web Audio DSP Chain
  • Visual State Machine, F1/F2 Formant Lip-Sync & Audio-Reactive HUD
  • Neural Silero VAD, Hands-Free Voice Call & Real Barge-In (src/services/speechService.ts):
  • Trilingual Experience (PT-BR / EN / JA) & Canonical Japanese Voice Mode (canonicalJpVoice):
  • Temporal Hiatus Telemetry ($\Delta t$), Live Call Greeting & End-of-Call Summarization:
  • Dynamic Few-Shot RAG, Canonical Lorebook & Episodic Memory (server/training/ & ChromaDB):
  • Multi-Provider LLM Orchestration (server/app/services/llm/):

πŸ’» Universal Hardware Compatibility & Benchmarks

OpenAmadeus scales from CPU-only laptops to local NVIDIA GPUs and free/low-cost Google Colab workers:

Tier / Engine Execution Mode Hardware / VRAM First Audio (TTFA) Speed (RTF) Notes & Capabilities
Tier 1: Edge-TTS (Universal) Cloud Neural Stream Any PC / Laptop (0 GB VRAM) ~400–900 ms > 3.00x Zero downloads required; works out-of-the-box on Windows, macOS, and Linux
Tier 2: Kokoro-TTS 82M (Offline) Local CPU / GPU CPU or GPU (~350 MB RAM/VRAM) ~80–300 ms > 2.50x 100% offline PT-BR synthesis (pf_dora), zero cloud dependency
Tier 3: Kokoro / Edge + RVC v2 Local Timbre Morph NVIDIA GPU (~2–4 GB VRAM FP16) ~800–1,500 ms ~1.50x Converts Kokoro or Edge speech into Kurisu's canonical acoustic timbre (KurisuRVCv147)
Tier 4: Qwen3-TTS (faster) Streaming PCM16 (CUDA Graphs) Colab L4/A100 or Local GPU (~4–6 GB VRAM) ~391 ms 1.92x (L4) End-to-end Kurisu synthesis with natural sighs, calibrated cadence, and pure-weight SFT stability
Tier 4 (Legacy): Qwen3-TTS (stock) Batch WAV (Dynamic Cache) NVIDIA GPU (~6 GB VRAM) ~14,000–20,000 ms ~0.44x Fallback batch mode when faster-qwen3-tts is disabled (QWEN_BACKEND=stock)

πŸ“ˆ Measured Performance & Optimization Gains (v0.3.2 β†’ v0.3.3)

Empirical runtime measurements collected with OpenAmadeus' built-in telemetry (/api/metrics) and server/scripts/benchmark_amadeus.py:

Persistent ONNX, Non-Blocking RAG & Honest Uncached Benchmarks (v0.3.2 β†’ v0.3.3)

Metric Before (v0.3.2) After (v0.3.3) Measured Gain
Gateway /api/health (p50 / p95) 20.2 / 135.3 ms 7.9 / 11.0 ms 2.6Γ— faster p50, 12.3Γ— lower p95
ONNX Warm-up (onnx_warmup_ms) 37,427.6 ms (1st probe) 204.5 ms Persistent ONNXMiniLM_L6_V2 session kept warm in RAM
RAG Uncached Query (rag_cold_query_ms, p50 / p95) 389.6 / 28,170.6 ms 9.7 / 13.4 ms 40Γ— faster p50 (single-query dynamic padding + zero collection.get())
RAG Cached Query (rag_cached_ms, LRU hit, p50 / p95) β€” 5.1 / 5.4 ms Sub-6 ms HNSW lookup on repeated prompts
Offline /api/chat (100% uncached, p50 / p95) 96.7 / 448.5 ms (with LRU hits) 34.6 / 39.2 ms Measured on unique uncached utterances (_embed_cache.clear())
Offline /api/chat/stream (100% uncached, p50 / p95) 87.7 / 420.2 ms (with LRU hits) 35.4 / 38.9 ms Non-blocking asyncio.to_thread + single SQLite connection per turn
Backend Unit Tests (88 tests) 71.66 s 21.06 s 3.4Γ— faster full suite

Cold-Start & Backend Pipeline (v0.3.1 β†’ v0.3.2)

Metric Before (v0.3.1) After (v0.3.2) Measured Gain
First Turn (Cold end-to-end, live) 29,353 ms 2,016–2,971 ms ~10×–14.5Γ— faster (background ONNX warm-up eliminates ~27.7 s stall)
LLM Model Discovery (GET /models, warm p50) 365–432 ms 0 ms Eliminated (10-min TTL cache + keep-alive httpx client)
RAG ONNX Embeddings per Turn 4Γ— 1Γ— -75% CPU (LRU single-embedding reuse across canonical, learned & 154 exemplars)
Offline /api/chat (p50) 369.2 ms 96.7 ms 3.8Γ— faster
Offline /api/chat/stream (p50) 693.6 ms 87.7 ms 7.9Γ— faster

Live Pipeline Breakdown (v0.3.2, Groq LPU + Remote Colab Qwen3-TTS Tunnel, cuda:0 4,247 MB VRAM)

Stage / Test Case First Byte / TTFA Speed / Duration Reliability & DSP Notes
Gateway /api/health 4.3 ms (p50: 5.9 ms) β€” Fast SELECT COUNT(*) SQLite + ChromaDB probe
Qwen3-TTS Stream β€” PT-BR (tsundere) 826.5 ms 1.52Γ— (5.76 s audio in 3.78 s) 6.8Γ— lower TTFA than batch WAV (5,599.6 ms, 0.90Γ—)
Qwen3-TTS Stream β€” EN (analytical) 810.4 ms 1.46Γ— (4.24 s audio in 2.91 s) Clean F0 (273 / 389 Hz), zero truncations
Qwen3-TTS Stream β€” JA (annoyed) 1,422.2 ms 1.12Γ— (3.52 s audio in 3.15 s) High-energy expressiveness (F0 462 / 600 Hz)
Live Multi-Turn Session (5–12 turns) LLM 1st Sent p50: ~1,946–2,016 ms TTS TTFB p50: 854–1,335 ms (1.5×–1.6Γ—) Discovery p50: 0 ms β€’ 0 PCM underruns β€’ 0 errors/fallbacks
Barge-In / Mid-Stream Abort Immediate cancel Instant recovery PASS β€” worker /health stays ready after mid-stream disconnect

Reproduce locally via python server/scripts/benchmark_amadeus.py --offline / --live or inspect live per-turn waterfalls in Setup β†’ SYSTEM.

πŸ›οΈ System Architecture & DSP Pipeline

flowchart TD
    subgraph Client["Frontend β€” React 19 / TypeScript / Vite (:5173)"]
        UI["HUD, ChatFeedStream, SettingsModal & Trilingual i18n (PT/EN/JA)"]
        SpriteEngine["AmadeusSpriteView (174 Sprite Pack / F1-F2 Formant Lip-Sync / Hologram)"]
        Oscilloscope["AudioOscilloscope (HTML5 Canvas FFT)"]
        MicVAD["Silero VAD v5 (@ricky0123/vad-web ONNX) + Groq Whisper STT"]
        Reader["speechService.ts: PCM16 Stream Reader + SentenceSpeaker"]
        DSP["Web Audio DSP: Jitter (+240ms) -> Make-up Gain (1.65x) -> Compressor (-20dB) -> AnalyserNode"]
        UI --> Reader
        MicVAD --> UI
        Reader --> DSP
        DSP --> SpriteEngine
        DSP --> Oscilloscope
    end

    subgraph Server["Backend β€” FastAPI Core Gateway (:8000)"]
        Router["API v1 Router (/chat, /chat/stream, /tts, /memories, /sessions)"]
        Orchestrator["Multi-Provider LLM Orchestrator + Trilingual Lorebook"]
        EmotionParser["Emotion Tag Parser, SentenceStream & clean_text_for_tts"]
        VoiceManager["voice_service.py (4-Stage Fallback Controller)"]
        Router --> Orchestrator
        Router --> VoiceManager
        Orchestrator --> EmotionParser
        EmotionParser --> VoiceManager
        VoiceManager -- "StreamingResponse (audio/L16, WAV, MP3)" --> Reader
    end

    subgraph VoiceEngines["Modular Voice Synthesis Engines"]
        QwenWorker["Kurisu Qwen3-TTS Multilingual (JA/EN/PT-BR, :8005 or Colab) β€” FasterQwen3TTS + C0 Ramp"]
        KokoroEngine["Kokoro-TTS 82M (lang_code='p', voice='pf_dora')"]
        EdgeTTS["Microsoft Edge-TTS (pt-BR / en-US / ja-JP)"]
        RVCWorker["Kurisu RVC v2 Pipeline (KurisuRVCv147 + HuBERT/JP-HuBERT + RMVPE)"]
        VoiceManager --> QwenWorker
        VoiceManager --> KokoroEngine
        VoiceManager --> EdgeTTS
        KokoroEngine -. "use_rvc=True" .-> RVCWorker
        EdgeTTS -. "use_rvc=True" .-> RVCWorker
        QwenWorker -- "audio/L16;rate=24000 (PCM Stream)" --> VoiceManager
        RVCWorker -- "audio/wav" --> VoiceManager
        KokoroEngine -- "audio/wav" --> VoiceManager
        EdgeTTS -- "audio/mpeg" --> VoiceManager
    end

    subgraph Persistence["Hybrid Memory & Fine-Tuning Layer"]
        SQLite[("SQLite: amadeus.db + End-of-Call Summaries")]
        ChromaDB[("ChromaDB: memory_db + 154 Trilingual Few-Shot Dialogues")]
    end

    subgraph ExternalLLMs["LLM Inference Providers"]
        Gemini["Google Gemini 2.5 Flash"]
        Groq["Groq LPU (Llama 3.3 70B / Qwen 3.8)"]
        OpenRouter["OpenRouter Free Tier (Gemma 4 / Nemotron)"]
        OfflineSim["Local Heuristic Offline Simulator"]
    end

    UI -- "POST /api/chat & /api/tts" --> Router
    Orchestrator <--> SQLite
    Orchestrator <--> ChromaDB
    Orchestrator --> Gemini
    Orchestrator --> Groq
    Orchestrator --> OpenRouter
    Orchestrator --> OfflineSim
Loading

πŸŽ™οΈ Neural Voice Models & Asset Setup

Switch between voice engines dynamically at runtime via the in-app Settings Modal (βš™οΈ):

1. Kurisu Qwen3-TTS 1.7B Multilingual β€” JA / EN / PT-BR (End-to-End Neural Streaming)

  • Hugging Face Checkpoint (Official v0.3.0): lucca3447/Makise_Kurisu_Qwen3_TTS_PTBR_added β€” extends starrydark/Makise_Kurisu_Qwen3_TTS / Qwen3-TTS (native Japanese & English) by adding Brazilian Portuguese (vn_only ep2 bilingual-replay LoRA via notebooks/Amadeus_Qwen3_TTS_PTBR_LoRA.ipynb), keeping speaker ID kurisu intact across all 3 languages.
  • Acceleration Runtime: andimarafioti/faster-qwen3-tts (captures the 28-layer Talker and 15-step Code Predictor into static-cache CUDA Graphs, cutting per-step latency from ~330 ms to ~54 ms).
  • Automatic Weight Caching: Weights (~3.8 GB) are downloaded automatically on first startup into ~/.cache/huggingface/hub/ (controlled by QWEN_MODEL_ID).
  • Manual Offline Clone (Optional): server/weights/kurisu_qwen3/ overrides the Hugging Face download when present:
    git lfs install
    git clone https://huggingface.co/lucca3447/Makise_Kurisu_Qwen3_TTS_PTBR_added server/weights/kurisu_qwen3

2. Kurisu RVC v2 (Retrieval-based Voice Conversion)

  • Hugging Face Checkpoint: FrancescoCaracciolo/Kurisu-RVC (KurisuRVCv147.pth + KurisuRVCv147.index).
  • Pipeline Features: Supports configurable consonant protect (rvcProtect), RMS envelope matching, and auto-detection of Japanese HuBERT (yky-h/japanese-hubert-base) checkpoints via transformers.
  • Directory Layout: Place KurisuRVCv147.pth and KurisuRVCv147.index inside server/weights/kurisu_rvc/:
    server/
    └── weights/
        β”œβ”€β”€ kurisu_rvc/
        β”‚   β”œβ”€β”€ KurisuRVCv147.pth
        β”‚   └── KurisuRVCv147.index
        └── models/
            β”œβ”€β”€ hubert_base.pt
            └── rmvpe.pt
    

3. Visual Novel Sprite Pack Setup (Optional)

To respect intellectual property, commercial Steins;Gate game assets are not distributed in this repository. OpenAmadeus includes a fully functional procedural holographic silhouette (AmadeusSpriteView.tsx) out of the box, requiring zero external assets.

If you wish to enable the authentic 174-sprite visual novel expressions locally:

  • Method A (Official Steam Extraction): Extract chara.mpk from your purchased Steam/GOG copy of Steins;Gate 0 using open-source extraction tools such as GARbro.
  • Method B (Community Preservation Reference): Consult the educational sprite sheet archive on The Spriters Resource (Asset #108143).

To automatically unpack and verify your assets into public/assets/sprites/kurisu/, run:

# Automated import from a downloaded .zip or folder:
python scripts/setup_sprites.py --import "path/to/archive.zip"

# Or verify existing assets in public/assets/sprites/kurisu/:
python scripts/setup_sprites.py

πŸš€ Quick Start Guide

Prerequisites

  • Node.js: v18.0.0+ (v20+ recommended)
  • Python: 3.10+
  • GPU (Optional): NVIDIA GPU (CUDA 12.4+) or a Google Colab session (L4/A100 recommended).

Step 1: Launch Frontend (:5173)

npm install   # postinstall automatically copies Silero VAD ONNX & WASM assets to public/vad/
npm run dev

The visual novel interface will be live at http://localhost:5173.

Step 2: Launch Core FastAPI Backend (:8000)

# Windows (PowerShell):
cd server
python -m venv rvc_env
.\rvc_env\Scripts\Activate.ps1
pip install -r requirements.txt
python -m uvicorn main:app --reload --port 8000  # or: python main.py

# Linux / macOS:
cd server
python3 -m venv rvc_env
source rvc_env/bin/activate
pip install -r requirements.txt
python -m uvicorn main:app --reload --port 8000  # or: python main.py

Interactive Swagger API documentation is available at http://localhost:8000/docs.

Step 3: Enable Real-Time Kurisu Qwen3-TTS (Google Colab or Local GPU)

Option A: Remote Google Colab GPU Worker (Recommended β€” Zero Local VRAM Needed)

  1. Upload or open notebooks/Amadeus_Qwen3_TTS_Colab.ipynb in Google Colab and select the NVIDIA L4 (best cost/latency ratio) or A100 runtime.
  2. Execute the cells. The notebook automatically installs sox, pins transformers==5.15.1, installs faster-qwen3-tts, captures CUDA Graphs, warms up the Mimi audio decoder, and prints a public Cloudflare Tunnel URL (https://*.trycloudflare.com).
  3. Open Settings (βš™οΈ) in OpenAmadeus, select Qwen3-TTS (Remote Colab), and paste the tunnel URL (or set QWEN_REMOTE_URL in server/.env).

Option B: Local NVIDIA GPU Worker (:8005)

cd server
python -m venv qwen_env
.\qwen_env\Scripts\Activate.ps1  # Linux/macOS: source qwen_env/bin/activate

# Install CUDA PyTorch + pinned Qwen3-TTS streaming dependencies
pip uninstall -y qwen-tts
pip install -r requirements-qwen.txt

# Launch worker (auto-detected by FastAPI on port 8005 if server/qwen_env exists)
python -m app.services.qwen_tts.qwen_worker

🧠 Kurisu Fine-Tuning & Dynamic Few-Shot RAG Pack (server/training/)

The server/training/ directory ships with a complete persona alignment toolkit:

  • Automatic Dynamic Few-Shot RAG (Zero Setup): On startup, memory_store.py indexes kurisu_finetuning_dataset_enhanced.jsonl (154 curated PT-BR / EN / JA ChatML dialogue exemplars with <!--emotion:...-->, <!--pose:...-->, <!--camera:...-->, and <!--remember:...--> tags) into ChromaDB with hash-based auto-resync, injecting the most semantically relevant canon responses in the active language into every LLM prompt.

Synaptic Memory Block Injection
Cortex Synaptic Injector β€” Injecting structured episodic memories into ChromaDB with cognitive domains, emotional valence, and lexical triggers.

- **Local Ollama Model Creation**: ```bash cd server/training ollama create amadeus-kurisu -f Modelfile ollama run amadeus-kurisu ``` - **15-Minute Unsloth LoRA Fine-Tuning**: Use `server/training/unsloth_finetuning.py` on a free Google Colab T4 GPU to train and export custom GGUF weights.

🐳 Docker Deployment

Spin up the full-stack CPU / Zero-VRAM environment (amadeus-frontend on Nginx :5173 + amadeus-backend on FastAPI :8000 with SQLite, ChromaDB, Cloud LLMs, Remote Colab Qwen3-TTS, and Edge-TTS) with persistent volumes:

docker compose up --build -d

βš™οΈ Configuration & REST API Reference

LLM Providers (Configurable in Settings βš™οΈ or Environment)

Provider Key Format Supported / Default Models Dashboard
Google Gemini AIzaSy... gemini-2.5-flash, gemini-1.5-flash aistudio.google.com
Groq Cloud LPU gsk_... llama-3.3-70b-versatile, qwen/qwen3.8-27b, openai/gpt-oss-120b console.groq.com
OpenRouter sk-or-... google/gemma-4-31b-it:free, nvidia/nemotron-3.5-lightning:free openrouter.ai
Offline Simulator None Deterministic Heuristic Persona Simulator 100% Offline

Primary Backend Endpoints (http://localhost:8000)

Endpoint Method Description
/api/health GET Core gateway health, uptime, ChromaDB vector count, and active subsystem status
/api/metrics GET Rolling (p50/p95) chat/RAG/LLM/TTS latency telemetry, cold vs. warm comparison, and error/fallback/abort counters
/api/metrics/reset POST Resets in-memory runtime metrics counters and rolling buffers (useful between benchmark runs)
/api/chat POST Conversational turn execution with RAG retrieval, emotion parsing, LLM fallback, and per-turn metrics
/api/chat/stream POST Sentence-level SSE streaming (meta -> sentence* -> done) with per-stage timing breakdown
/api/tts POST Universal speech synthesis (audio/L16;rate=24000 PCM stream, audio/wav, or audio/mpeg) emitting X-TTS-* headers
/api/voice/status GET Real-time diagnostics across Remote Qwen3, Local Qwen3 (:8005), Kokoro, and RVC v2
/api/voice/ping POST Probes Qwen3-TTS worker /health and measures round-trip latency + allocated VRAM
/api/voice/models GET Lists discovered RVC checkpoints, Kokoro voices (pf_dora), and Edge-TTS voices
/api/memories GET / POST / DELETE Episodic semantic memory inspection and management (ChromaDB + SQLite)
/api/sessions GET / POST / DELETE Conversation session persistence and history retrieval

πŸ“ Repository Structure

OpenAmadeus/
β”œβ”€β”€ notebooks/
β”‚   β”œβ”€β”€ Amadeus_Qwen3_TTS_Colab.ipynb      # Remote Colab GPU worker (FasterQwen3TTS + Cloudflare Tunnel)
β”‚   β”œβ”€β”€ Amadeus_Qwen3_TTS_PTBR_LoRA.ipynb  # LoRA training notebook adding PT-BR while preserving JA/EN
β”‚   └── spike_faster_qwen3.py              # TTFA/RTF benchmark & audio parity validation script
β”œβ”€β”€ public/
β”‚   β”œβ”€β”€ amadeus-icon.svg                   # Application vector emblem
β”‚   β”œβ”€β”€ vad/                               # Local Silero VAD ONNX & ONNX Runtime WASM assets (postinstall)
β”‚   └── assets/sprites/kurisu/             # Local destination for optional 174 sprite PNGs (gitignored)
β”œβ”€β”€ scripts/
β”‚   β”œβ”€β”€ copy-vad-assets.mjs                # Copies @ricky0123/vad-web & onnxruntime-web files to public/vad/
β”‚   β”œβ”€β”€ eval_emotion_fidelity.py           # Emotion/tag fidelity evaluation helper
β”‚   β”œβ”€β”€ optimize_sprites.py                # Sprite image optimizer
β”‚   └── setup_sprites.py                   # Sprite asset pack validator and directory initializer
β”œβ”€β”€ server/                                # FastAPI Python Backend
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ api/v1/endpoints/              # Modular route handlers (chat, voice, memory, persona)
β”‚   β”‚   β”œβ”€β”€ core/                          # config.py paths, model lists, and FastAPI lifespan
β”‚   β”‚   β”œβ”€β”€ db/                            # Hybrid SQLite + ChromaDB vector persistence (memory_store.py)
β”‚   β”‚   β”œβ”€β”€ schemas/                       # Pydantic request/response contracts (chat, memory, voice)
β”‚   β”‚   └── services/
β”‚   β”‚       β”œβ”€β”€ llm/                       # Multi-provider orchestrator, Lorebook, SentenceStream (gemini, groq, openrouter)
β”‚   β”‚       β”œβ”€β”€ qwen_tts/                  # qwen_worker.py, qwen_manager.py, emotion_mapper.py (21 empirical targets)
β”‚   β”‚       β”œβ”€β”€ kokoro_tts/                # kokoro_manager.py (82M PT-BR local synthesis)
β”‚   β”‚       β”œβ”€β”€ rvc/                       # rvc_manager.py, rvc_worker.py, pipeline.py & lib/ (HuBERT, RMVPE, PureTorchIndex)
β”‚   β”‚       β”œβ”€β”€ voice_service.py           # 4-stage voice cascade & trilingual clean_text_for_tts sanitizer
β”‚   β”‚       β”œβ”€β”€ emotion_service.py         # Sentiment/pose/camera parsing & trilingual shift inference
β”‚   β”‚       β”œβ”€β”€ metrics.py                 # In-memory rolling latency/reliability registry (p50/p95, cold vs. warm)
β”‚   β”‚       └── offline_simulator.py       # Zero-internet trilingual heuristic dialogue fallback
β”‚   β”œβ”€β”€ personas/                          # Persona definitions, languageProfiles & canonical memories (kurisu.json)
β”‚   β”œβ”€β”€ scripts/                           # Unified E2E benchmark CLI (benchmark_amadeus.py), DSP probes & RAG calibration
β”‚   β”œβ”€β”€ training/                          # 154-pair PT/EN/JA ChatML dataset, Unsloth LoRA script, Ollama Modelfile
β”‚   β”œβ”€β”€ tests/                             # Unit, streaming, metrics, RAG & RVC suites (test_metrics.py, test_chat_stream.py, etc.)
β”‚   β”œβ”€β”€ weights/                           # Local model directory (kurisu_rvc/, kurisu_qwen3/, models/)
β”‚   β”œβ”€β”€ main.py                            # FastAPI gateway entry point
β”‚   β”œβ”€β”€ remote_worker.py                   # Standalone remote worker runner
β”‚   β”œβ”€β”€ requirements.txt                   # Universal CPU backend dependencies
β”‚   └── requirements-qwen.txt              # GPU worker dependencies (faster-qwen3-tts, transformers==5.15.1)
β”œβ”€β”€ src/                                   # React 19 + TypeScript + Vite Frontend
β”‚   β”œβ”€β”€ components/                        # AmadeusSpriteView, AudioOscilloscope, SettingsModal, etc.
β”‚   β”œβ”€β”€ data/personas/                     # Frontend persona metadata (kurisu.ts)
β”‚   β”œβ”€β”€ services/                          # speechService.ts (Silero VAD + F1/F2 Lip-Sync + PCM16 DSP), vadGate, aiService, memoryService
β”‚   β”œβ”€β”€ types/                             # TypeScript domain contracts (amadeus.ts)
β”‚   β”œβ”€β”€ i18n.ts                            # Complete PT-BR / EN / JA UI translation dictionary
β”‚   β”œβ”€β”€ App.tsx                            # Main visual novel & call state orchestrator
β”‚   └── main.tsx                           # React DOM entry point
β”œβ”€β”€ docker-compose.yml                     # Full-stack multi-container orchestration
β”œβ”€β”€ Dockerfile                             # Multi-stage frontend production build
└── package.json                           # Frontend dependencies and build scripts

πŸ§ͺ Testing, Latency Telemetry & Benchmarking

Live runtime diagnostics are available directly in the UI (click the TTFA latency pill in the top bar or open Setup β†’ SYSTEM) showing the per-turn waterfall (STT β†’ RAG β†’ Model Discovery β†’ LLM TTFT / 1st Sentence β†’ TTS TTFB), rolling p50/p95 stats, PCM underrun counts, and cold vs. warm averages.

Live Latency Telemetry & Diagnostics Panel
Setup β†’ SYSTEM (native <dialog> modal) β€” Live Latency Telemetry & Diagnostics (p50/p95 percentiles, cold vs. warm averages, 1-click subsystem probes) paired with the Active Runtime Stack ledger for v0.3.3.

Run the automated test and benchmark suites before submitting pull requests:

# 1. Backend unit tests (core API, metrics, Qwen3 streaming, C0 DSP ramp, text sanitizer, and RVC)
python -m unittest discover -s server/tests -p "test_*.py"

# 2. Frontend TypeScript strict type-checking and production build verification
npx tsc --noEmit
npm run build

# 3. Unified E2E latency & functioning benchmark (deterministic offline β€” zero API cost)
python server/scripts/benchmark_amadeus.py --offline

# 4. Live E2E benchmark (real LLM cold vs. warm + Colab/local Qwen3-TTS streaming, DSP & barge-in)
python server/scripts/benchmark_amadeus.py --live --in-process --api-key "<KEY>" --qwen-url "https://<tunnel>.trycloudflare.com"

Timestamped JSON and Markdown benchmark reports are saved automatically to server/data/benchmarks/.

πŸ—ΊοΈ Roadmap

OpenAmadeus follows Semantic Versioning 2.0.0 (MAJOR.MINOR.PATCH) under a strict 3-Tier Execution Triad (Free Cloud / Local Mainstream 8–12GB GPU / Local Ultra-Lightweight CPU).

For the complete granular evolution timeline, technical milestones, and architectural decisions from v0.1.0 through v1.0.0, see docs/ROADMAP.md.

🀝 Contributing, Versioning & Commit Standards

Contributions, bug reports, and acoustic calibration improvements are welcome!

  1. Versioning: This project adheres to Semantic Versioning 2.0.0 (MAJOR.MINOR.PATCH).
  2. Branching: Create a feature branch from main (e.g., feat/faster-qwen3-tts or feat/emotion-calibration).
  3. Commit Format: Use atomic commits following the Conventional Commits specification:
    • feat(qwen-tts): ... for synthesis worker, CUDA Graph runtime, and boundary DSP features
    • feat(voice): ... for fallback orchestration, text sanitization, and emotion_mapper.py tuning
    • feat(frontend): ... for UI components, Web Audio API DSP, and lip-sync updates
    • chore(colab): ... for notebook and remote worker tooling
    • test(voice): ... for unit and integration tests
  4. Verification: Ensure all Python unit tests and npx tsc --noEmit pass cleanly before opening a Pull Request.

πŸ™ Credits & Third-Party References

OpenAmadeus builds upon the following open-source libraries, pre-trained weights, and research works:

Voice Synthesis & Voice Conversion

Voice Activity Detection (VAD), Audio & RAG

  • snakers4 / silero-vad (MIT): Pre-trained enterprise-grade Silero VAD v5 neural speech detector (Silero Team, 2024, "Silero VAD: pre-trained enterprise-grade Voice Activity Detector (VAD), Number Detector and Language Classifier").
  • ricky0123 / vad (@ricky0123/vad-web) (ISC): Browser AudioWorklet / MicVAD wrapper running Silero VAD locally in WebAssembly.
  • microsoft / onnxruntime (onnxruntime-web) (MIT): In-browser WebAssembly / SIMD neural inference runtime powering Silero VAD.
  • chroma-core / chroma (Apache-2.0): Open-source vector database powering dynamic few-shot & episodic RAG.

βš–οΈ Legal Disclaimer & Intellectual Property Notice

Non-Commercial Project:
OpenAmadeus Companion is an independent, non-commercial open-source research and educational tribute project inspired by Steins;Gate 0. It is free, non-monetized, and open to the community for exploring human-computer interaction and multimodal conversational agents under the GNU General Public License v3.0.

Trademarks & Copyrights:
All characters, names, lore, and visual assets related to STEINS;GATE (including Makise Kurisu, Amadeus System, Viktor Chondria University, and Lab 304) are registered trademarks and copyrighted properties of MAGES. Inc. / 5pb. / Chiyomaru Studio / KADOKAWA. This project is not affiliated with, endorsed by, or sponsored by these entities.

Voice Models & Attribution:
The community acoustic models (RVC v2 and Qwen3-TTS) are hosted externally on Hugging Face by independent researchers. They represent experimental synthetic voice emulation and are neither officially endorsed by nor affiliated with the original voice cast or copyright holders.

Asset Distribution Policy:
To respect copyright boundaries, no commercial game assets or sprite images are bundled or tracked in this Git repository. The engine functions natively with a stylized procedural holographic silhouette. Users wishing to apply local character sprites do so privately on their own machines (python scripts/setup_sprites.py).

Notice & Takedown:
If you are a copyright holder and believe any material exceeds fair use or infringes your rights, please open an Issue for prompt resolution or removal.

Releases

Contributors

Languages