How moonshine-ai/moonshine works
Moonshine Voice is an on-device toolkit for real-time voice applications. Its principal workflow accepts live or recorded audio, transcribes it, and exposes transcript events; applications can also synthesize speech, identify speakers, and match spoken phrases by meaning. The graph includes the C/C++ runtime, speech and language-processing capabilities, and available platform entry points. README establishes the major product capabilities; sampled source confirms selected runtime implementations and the WASM worker flow, but not the wiring of every platform or subsystem.
Main entry points: moonshine-cpp.h C++ API · moonshine-streaming-model.cpp Streaming Runtime · moonshine-c-api.cpp C API · embedding_model.py Python Embeddings
Components 22
Speech Recognition
- Model Runtime
core/moonshine-model.cpp - Streaming Runtime
core/moonshine-streaming-model.cpp - Transcription
core/transcriber.cpp
Speech Processing
- Audio Preparation
core/resampler.cpp - Speech Clips
core/speech-clip.cpp - Voice Detection
core/silero-vad.cpp - Speaker Diarization
core/speaker-diarizer.cpp - Diarization Engine
core/cpp-annote/src/cpp-annote-engine.h
Language Features
- Text-to-Speech
core/moonshine-tts/src/moonshine-tts.cpp - Grapheme-to-Phoneme
core/moonshine-tts/src/moonshine-g2p.cpp - Embedding API
core/text-embedder.cpp - Gemma Embeddings
core/gemma-embedding-model.cpp - Embedding Cache
language-bindings/python/src/moonshine_voice/cached_embeddings.py
Runtime Interfaces
- C API
core/moonshine-c-api.cpp - C++ API
core/moonshine-cpp.h - Model Catalog
core/moonshine-model-catalog.cpp - WASM Worker Host
language-bindings/wasm/src/stt-worker-host.ts - WASM Worker
language-bindings/wasm/src/stt-worker.ts - Python Embeddings
language-bindings/python/src/moonshine_voice/embedding_model.py - Swift Embeddings
language-bindings/swift/Sources/MoonshineVoice/EmbeddingModel.swift - Android Downloads
language-bindings/android/java/main/java/ai/moonshine/voice/MoonshineDownloadWorker.java
Other components
- Application Developer
Connections 22
- Application Developer → C++ API: uses library
- Application Developer → C API: uses library
- Application Developer → Model Catalog: selects models
- C++ API → Model Runtime: runs models
- C++ API → Streaming Runtime: streams audio
- WASM Worker Host → WASM Worker: dispatches requests
- WASM Worker → Transcription: transcribes streams
- Transcription → Streaming Runtime: processes audio
- Streaming Runtime → Model Runtime: runs inference
- Application Developer → Audio Preparation: provides audio
- Audio Preparation → Speech Clips: prepares clips
- Application Developer → Voice Detection: detects speech
- Application Developer → Speaker Diarization: requests speakers
- Speaker Diarization → Diarization Engine: analyzes speakers
- Application Developer → Text-to-Speech: requests synthesis
- Text-to-Speech → Grapheme-to-Phoneme: converts text
- Application Developer → Embedding API: requests embeddings
- Embedding API → Gemma Embeddings: embeds text
- Python Embeddings → C API: calls native API
- Python Embeddings → Embedding Cache: uses cache
- Swift Embeddings → C API: calls native API
- Android Downloads → Model Catalog: prepares model assets