Star 历史趋势
数据来源: GitHub API · 生成自 Stargazers.cn
README.md

Rhema logo

Rhema

Real-time AI-powered Bible verse detection for live sermons and broadcasts. A Tauri v2 desktop app with a React frontend and Rust backend.

Rhema listens to a live sermon audio feed, transcribes speech in real time, detects Bible verse references (both explicit citations and quoted passages), and renders them as broadcast-ready overlays via NDI for live production.

Features

  • Real-time speech-to-text via local Whisper or cloud Deepgram (WebSocket streaming + REST fallback)
    • Whisper runs locally with no API costs; Deepgram streams via WebSocket with REST fallback
  • Voice-controlled translation switching — say "read in NIV" or "switch to ESV" to change translations instantly during a sermon
  • Multi-strategy verse detection
    • Direct reference parsing (Aho-Corasick automaton + fuzzy matching)
    • Semantic search — Qwen3-0.6B ONNX embeddings, brute-force cosine similarity over ~31k verse vectors (the hnsw_index.rs file is named after a future plan; today it scans linearly)
    • Quotation matching against known verse text
    • Reading mode — locks to book/chapter as soon as it's mentioned, with voice navigation ("next chapter", "chapter 5")
    • Sermon context tracking and sentence buffering
  • SQLite Bible database with FTS5 full-text search (BM25 ranking by default)
  • 10 bundled translations — KJV, NIV, ESV, NASB, NKJV, NLT, AMP, plus SpaRV (Spanish), FreJND (French), and PorBLivre (Portuguese)
  • Cross-reference lookup (340k+ refs from openbible.info; the bundled file ships with 344,800 entries)
  • NDI broadcast output for live production integration — configurable resolution, 24/30/60 fps, and three alpha modes (none, straight, premultiplied)
  • Theme designer — visual canvas editor for verse overlays with backgrounds (solid, gradient, image, transparent), text styling, positioning, shadows, and outlines
  • Verse queue with drag-and-drop ordering (@dnd-kit/react) and duplicate prevention (flash-highlight on duplicates)
  • Quick navigation — keyboard-driven verse entry with autocomplete (e.g., type "J" → Joshua, Tab through book → chapter → verse)
  • Fuzzy contextual search (Fuse.js client-side)
  • Audio level metering and on-air indicator
  • Interactive onboarding tutorial — 11-step guided tour covering all panels, auto-launches on first startup
  • Light/dark mode with system theme detection (light, dark, or follow OS)
  • Settings persistence — all preferences auto-saved to disk across restarts
  • Cross-platform — Windows, macOS, and Linux
  • Remote control via OSC and HTTP API for hardware controllers and automation

Tech Stack

LayerTechnologies
FrontendReact 19, TypeScript, Tailwind CSS v4, shadcn/ui, Zustand, Vite 7
BackendTauri v2, Rust (workspace with 7 crates)
AI/MLONNX Runtime (Qwen3-0.6B embeddings), Aho-Corasick, Fuse.js
DatabaseSQLite via rusqlite (bundled) with FTS5
BroadcastNDI 6 SDK via dynamic loading (libloading FFI)
STTLocal Whisper via whisper-rs; Deepgram WebSocket + REST (tokio-tungstenite)

Rust Crates

CratePurpose
rhema-audioAudio device enumeration, capture, VAD (cpal)
rhema-sttLocal Whisper (gated behind whisper Cargo feature) and Deepgram STT streaming + REST fallback
rhema-bibleSQLite Bible DB, FTS5 search, cross-references
rhema-detectionVerse detection pipeline: direct, semantic, quotation, ensemble merger, sentence buffer, sermon context, reading mode
rhema-broadcastNDI video frame output via FFI
rhema-apiTauri command API layer
rhema-notes(placeholder)

Prerequisites

  • Bun (runtime for scripts + package manager)
  • Rust toolchain (stable, 1.77.2+)
  • Tauri v2 prerequisites (platform-specific system dependencies)
  • Python 3 (for downloading copyrighted translations and embedding model export)
  • CMake + LLVM/libclang (required for local Whisper STT) — see Platform-specific setup below
  • Deepgram API key (optional, for cloud speech-to-text instead of Whisper)

Platform-specific setup

The local Whisper STT build compiles whisper.cpp from source, which requires CMake and libclang (via bindgen). Pick the command block for your OS:

macOS

brew install cmake

Linux (Debian/Ubuntu)

sudo apt install cmake clang libclang-dev

Linux (Arch)

sudo pacman -S llvm clang cmake

Windows

Windows needs an extra build-tools bootstrap before the shared setup pipeline — LLVM/libclang and CMake aren't available out of the box.

  1. Install Visual Studio 2022 with the Desktop development with C++ workload (provides MSVC).
  2. From the repo root:
    bun install
    bun run setup:windows
    This installs LLVM + CMake via winget and persists LIBCLANG_PATH.
  3. Close the terminal and open a new one so LIBCLANG_PATH is inherited by subsequent commands.
  4. Continue with Quick Setup (bun run setup:all) and then bun run tauri dev.

Getting Started

git clone <repo-url>
cd rhema
bun install

Quick Setup (recommended)

One command sets up everything — Python virtual environment, Bible data, database, ONNX model, precomputed embeddings, and the local Whisper model:

Windows: run bun run setup:windows before setup:all and restart your terminal. See Platform-specific setup above.

bun run setup:all

This runs 7 idempotent phases in sequence, skipping any whose output artifacts already exist (pass --force to re-run all):

  1. Python environment (.venv + pip deps: optimum-onnx[onnxruntime], sentence-transformers, accelerate, tokenizers, numpy, torch, meaningless)
  2. Download Bible source data — single bundled archive containing all 10 translations plus the openbible.info cross-references zip
  3. Build SQLite Bible database (data/rhema.db with FTS5 + cross-references)
  4. Download & export ONNX model (Qwen3-Embedding-0.6B) + INT8 quantization for ARM64
  5. Export KJV verses to JSON for embedding precomputation
  6. Precompute verse embeddings (GPU sentence-transformers when available, ONNX CPU fallback otherwise)
  7. Download Whisper model (ggml-large-v3-turbo-q8_0.bin) into models/whisper/

Environment

Speech-to-Text Options

Rhema supports two speech-to-text engines:

Option 1: Whisper (Local, Free) Whisper runs locally on your machine with no API costs or per-minute billing.

  • Requires CMake + libclang — see Platform-specific setup above
  • The model (ggml-large-v3-turbo-q8_0.bin) is fetched as phase 7 of setup:all. Run bun run download:whisper to grab it on its own.

Option 2: Deepgram (Cloud, Paid) Create a .env file in the project root:

DEEPGRAM_API_KEY=your_key_here

Get your API key at deepgram.com

NDI SDK (optional)

For broadcast output via NDI:

bun run download:ndi-sdk

Running individual setup steps

Each phase can also be run independently:

bun run download:bible-data          # Bundled translations + cross-refs
bun run build:bible                  # Build SQLite database
bun run download:model               # Download & export ONNX model
bun run export:verses                # Export verses to JSON
bun run precompute:embeddings        # Rust ONNX (recommended); see also -onnx and -py variants
bun run download:whisper             # Whisper STT model

Run in development

bun run tauri dev

Build for production

bun run tauri build

Project Structure

rhema/
├── src/                          # React frontend
│   ├── components/
│   │   ├── broadcast/            # Theme designer, NDI settings
│   │   ├── controls/             # Transport bar
│   │   ├── layout/               # Dashboard layout
│   │   ├── panels/               # Transcript, preview, live output, queue, search, detections
│   │   └── ui/                   # shadcn/ui + custom components
│   ├── hooks/                    # useAudio, useTranscription, useDetection, useBible, useBroadcast
│   ├── stores/                   # Zustand stores (audio, transcript, bible, queue, detection, broadcast, settings)
│   ├── types/                    # TypeScript type definitions
│   └── lib/                      # Context search (Fuse.js), verse renderer (Canvas 2D), builtin themes
├── src-tauri/                    # Rust backend (Tauri v2)
│   ├── crates/
│   │   ├── audio/                # Audio capture & metering (cpal)
│   │   ├── stt/                  # Deepgram STT (WebSocket + REST)
│   │   ├── bible/                # SQLite Bible DB, search, cross-references
│   │   ├── detection/            # Verse detection pipeline
│   │   │   ├── direct/           # Aho-Corasick + fuzzy reference parsing
│   │   │   └── semantic/         # ONNX embeddings, HNSW index, cloud booster, ensemble
│   │   ├── broadcast/            # NDI output (FFI)
│   │   ├── api/                  # Tauri command layer
│   │   └── notes/                # (placeholder)
│   └── tauri.conf.json
├── data/                         # Bible data pipeline
│   ├── prepare-embeddings.ts     # Unified setup orchestrator (bun run setup:all)
│   ├── lib/python-env.ts         # Shared Python venv management utilities
│   ├── download-sources.ts       # Download public domain translations + cross-refs
│   ├── download-biblegateway.py  # Download copyrighted translations (NIV, ESV, etc.)
│   ├── build-bible-db.ts         # Build SQLite DB from JSON sources
│   ├── compute-embeddings.ts     # Export verses to JSON for embedding
│   ├── precompute-embeddings.py  # Precompute embeddings (GPU auto-detect, ONNX fallback)
│   ├── download-model.ts         # Export & quantize Qwen3 ONNX model
│   ├── download-ndi-sdk.ts       # Download NDI SDK libraries
│   └── schema.sql                # Database schema
├── models/                       # ML models (gitignored)
├── embeddings/                   # Precomputed vectors (gitignored)
├── sdk/ndi/                      # NDI SDK files (downloaded)
└── build/                        # Vite build output

Scripts

ScriptDescription
setup:allFull setup — runs all 7 data/model/embedding/whisper phases (idempotent; pass --force to re-run)
setup:windowsWindows bootstrap — installs LLVM + CMake via winget and persists LIBCLANG_PATH
devStart Vite dev server
buildTypeScript check + Vite production build
tauriRun Tauri CLI commands
testRun Vitest tests
lintESLint
formatPrettier formatting
typecheckTypeScript type checking
previewPreview production build
download:bible-dataDownload bundled Bible translation archive + cross-references
build:bibleBuild SQLite Bible database from JSON sources
download:modelExport Qwen3-Embedding-0.6B to ONNX + quantize to INT8
export:versesExport KJV verses to JSON for embedding precomputation
precompute:embeddingsPrecompute embeddings via Rust ONNX binary (recommended)
precompute:embeddings-onnxPrecompute embeddings via Python ONNX Runtime
precompute:embeddings-pyPrecompute embeddings via Python sentence-transformers (GPU path)
quantize:modelQuantize ONNX model to INT8 for ARM64
download:whisperDownload ggml-large-v3-turbo-q8_0.bin for local Whisper STT
download:ndi-sdkDownload NDI 6 SDK headers and platform libraries
web:dev, web:build, web:start, web:lintMarketing + Fumadocs documentation site under web/

Security

Rhema enforces a restrictive Content Security Policy on the Tauri webview to prevent script injection and unauthorized data exfiltration. The policy is defined in src-tauri/tauri.conf.json; see SECURITY.md for the directive-by-directive rationale, threat model, and vulnerability reporting process.

Environment Variables

Create a .env file in the project root (optional):

VariableRequiredDescription
DEEPGRAM_API_KEYOptionalAPI key for Deepgram speech-to-text (not needed if using Whisper)

关于 About

Real-time AI Bible verse detection for live sermons. Tauri desktop app with NDI broadcast output

语言 Languages

TypeScript41.6%
Rust37.6%
C11.6%
MDX5.5%
Python2.2%
CSS0.9%
PowerShell0.3%
JavaScript0.3%
HTML0.0%

提交活跃度 Commit Activity

代码提交热力图
过去 52 周的开发活跃度
71
Total Commits
峰值: 39次/周
Less
More

核心贡献者 Contributors