Skip to content

Latest commit

 

History

129 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

Download

Platform Requires
Windows Rhema-windows-x64-setup.exe Windows 10/11 x64
macOS Rhema-macos-arm64.dmg macOS 11 Big Sur or newer, Apple Silicon
Linux Rhema-linux-x86_64.AppImage x86_64; .deb and .rpm on the release page

There is no Intel Mac build — on an Intel Mac, build from source.

Every build is unsigned — there is no Apple Developer or Windows code signing certificate behind this project — so each OS warns on first run.

Windows: SmartScreen warns — More info → Run anyway.

macOS: drag Rhema.app to Applications first, then open it. Gatekeeper blocks unsigned apps that carry the browser's quarantine flag; on macOS 15 and newer the right-click → Open trick no longer works, so use:

  • System Settings → Privacy & Security, scroll to the blocked-app notice, then Open Anyway, or

  • clear the quarantine flag yourself:

    xattr -cr /Applications/Rhema.app

Releases do not bundle the embedding model or the Whisper model — together they exceed a gigabyte. The Bible database ships inside the app, so reference detection and keyword search work out of the box; embedding re-ranking and local speech-to-text stay inactive until you build from source and run bun run setup:all. All releases are listed at github.com/openbezal/rhema/releases.

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

Layer Technologies
Frontend React 19, TypeScript, Tailwind CSS v4, shadcn/ui, Zustand, Vite 7
Backend Tauri v2, Rust (workspace with 7 crates)
AI/ML ONNX Runtime (Qwen3-0.6B embeddings), Aho-Corasick, Fuse.js
Database SQLite via rusqlite (bundled) with FTS5
Broadcast NDI 6 SDK via dynamic loading (libloading FFI)
STT Local Whisper via whisper-rs; Deepgram WebSocket + REST (tokio-tungstenite)

Rust Crates

Crate Purpose
rhema-audio Audio device enumeration, capture, VAD (cpal)
rhema-stt Local Whisper (gated behind whisper Cargo feature) and Deepgram STT streaming + REST fallback
rhema-bible SQLite Bible DB, FTS5 search, cross-references
rhema-detection Verse detection pipeline: direct, semantic, quotation, ensemble merger, sentence buffer, sermon context, reading mode
rhema-broadcast NDI video frame output via FFI
rhema-api Tauri 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 (only for the optional --with-embedding setup and downloading copyrighted translations)
  • 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 you need — Bible data, database, and the local Whisper model. It finishes in minutes and needs no Python:

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

bun run setup:all

This runs the required phases idempotently, skipping any whose output artifacts already exist (pass --force to re-run all):

  1. Python environment — skipped by default (only needed for --with-embedding below)
  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. –6. ONNX model + verse embeddings — skipped by default (see below)
  5. Download Whisper model (ggml-large-v3-turbo-q8_0.bin) into models/whisper/

Optional: embedding re-ranking (--with-embedding)

Everything above gives you the full search experience: live verse detection, exact/partial quote search, and typed references ("John 3:16") — benchmarked at recall@1 0.836 across 152 queries. The embedding model adds semantic paraphrase matching in the Context search tab on top of that.

bun run setup:all --with-embedding

What you gain: better paraphrase queries in Context search — e.g. "God will never abandon you" finds Hebrews 13:5. Benchmark: paraphrase recall@5 goes from 0.800 to 1.000; results gain Semantic badges with a real similarity %. Nothing else changes — exact quotes, verse fragments, typed references, and live detection are identical with or without it (overall recall@1 is 0.836 without vs 0.829 with).

What it costs: a one-time ~2.5 hour build (Hugging Face model export, INT8 quantization, embedding all 31k verses with the same ONNX model the app runs), ~3.3 GB of disk (models/ + embeddings/), the Python toolchain, and roughly 600–900 MB of extra memory while the app is running.

You can opt in at any time later — the app detects the assets on next launch. Without them it logs a single info line and runs keyword + reference search at full quality.

Fixing a provenance mismatch. The app verifies at startup that the embedding index was built with the same ONNX model it loaded (embeddings/*.meta.json sidecar). If it warns about a mismatch — typically after the model was re-downloaded or updated while an old index stayed on disk — delete the stale index and rebuild:

rm -f embeddings/kjv-qwen3-0.6b*        # Windows: delete embeddings\kjv-qwen3-0.6b* files
bun run setup:all --with-embedding

The delete matters: setup skips any artifact that already exists, so a stale index looks "done" until it's removed. A mismatched index silently wrecks semantic accuracy (this exact bug shipped once — correct matches scored ~0.65 cosine instead of ~1.0), which is why the app checks.

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:whisper             # Whisper STT model

# Embedding re-ranking assets (optional — see above):
bun run download:model               # Download & export ONNX model
bun run export:verses                # Export verses to JSON
bun run precompute:embeddings        # Rust ONNX precompute (writes the provenance sidecar — always use this one)

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

Script Description
setup:all Full setup — runs all 7 data/model/embedding/whisper phases (idempotent; pass --force to re-run)
setup:windows Windows bootstrap — installs LLVM + CMake via winget and persists LIBCLANG_PATH
dev Start Vite dev server
build TypeScript check + Vite production build
tauri Run Tauri CLI commands
test Run Vitest tests
lint ESLint
format Prettier formatting
typecheck TypeScript type checking
preview Preview production build
download:bible-data Download bundled Bible translation archive + cross-references
build:bible Build SQLite Bible database from JSON sources
download:model Export Qwen3-Embedding-0.6B to ONNX + quantize to INT8
export:verses Export KJV verses to JSON for embedding precomputation
precompute:embeddings Precompute embeddings via Rust ONNX binary (recommended)
precompute:embeddings-onnx Precompute embeddings via Python ONNX Runtime
precompute:embeddings-py Precompute embeddings via Python sentence-transformers (GPU path)
quantize:model Quantize ONNX model to INT8 for ARM64
download:whisper Download ggml-large-v3-turbo-q8_0.bin for local Whisper STT
download:ndi-sdk Download NDI 6 SDK headers and platform libraries
web:dev, web:build, web:start, web:lint Marketing + 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):

Variable Required Description
DEEPGRAM_API_KEY Optional API 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

Resources

Code of conduct

Contributing

Security policy

Stars

344 stars

Watchers

8 watching

Forks

Releases

Packages

Contributors

Languages