Repository navigation
VOICE_RECOGNITION_HOST
Status: Partial
Last Updated: 2026-11-13
Audience: Developers and coding agents
Last verified: 2026-11-13 against 5f40af2d9 (engine parity, service operations, and port; numeric thresholds, hardware results, and licenses not rechecked)
Code: src/Martlet.Sherpa/SpeakerEngine.cs, workers/voice-recognition/host/martlet_voice_recognition_host.py
The voice-recognition host role recognizes who is speaking on a paired
Martlet host. It does what Companion › People does on the companion PC's own
processor (src/Martlet.Sherpa/SpeakerEngine.cs, see Voices),
with the same models and the same steps:
- pyannote segmentation 3.0 finds who spoke when. It finds up to three people in each ten seconds and groups longer speech by voice (clustering threshold 0.5).
- WeSpeaker ResNet34-LM, trained on VoxCeleb, makes a 256-number voiceprint from each person's clean speech only (nobody else talking at that time).
Because the models and the steps are the same, a voiceprint from the host matches the shared voice list exactly like a voiceprint from the desktop.
The host runs the models on its NVIDIA graphics card when it has one (ONNX Runtime's CUDA provider), and otherwise on its processor. This keeps the work off a companion PC that is busy with a game.
Install it with the normal host flow:
martlet-host add voice-recognitionThe role asks for the accelerator (gpu or cpu) when the host can run GPU
containers, and for the model (VOICE_RECOGNITION_MODEL). There is one model,
wespeaker-en-voxceleb-resnet34-lm, the desktop's. ARM64 hosts always use the
processor build (compose.arm64.yaml).
The role requires Docker. It builds an image on the host from
workers/voice-recognition/host/Dockerfile:
-
python:3.12.10-slim-bookwormand hash-pinned PyPI wheels. - On the processor (
martlet-voice-recognition:2): sherpa-onnx1.13.8with ONNX Runtime1.28.2and NumPy2.5.3, for Linux x86_64 and aarch64. These are the same pins as the Parakeet worker and the same runtime as the desktop. - On the graphics card (
martlet-voice-recognition-cuda:2,compose.gpu.yaml): sherpa-onnx1.13.8's own CUDA 12 build with ONNX Runtime1.28.2(from k2-fsa's Hugging Face wheels, pinned to a commit and SHA-256) and NVIDIA's CUDA 12 and cuDNN 9 libraries from PyPI, about 2 GB more. It needs an NVIDIA driver for CUDA 12. - The two models from the desktop build's pinned URLs, each checked for its size and SHA-256, baked into the image. The container downloads nothing when it runs.
The build analyzes generated sound with the models before it finishes. The
images set ORT_DISABLE_TELEMETRY=1.
When the service starts, it listens at once and loads the models in the
background. With the gpu accelerator it first loads the models with CUDA in a
child process. When that fails (no card, no driver or a driver that is too old),
it uses the processor and says so in its log and its status. The role's warm
step waits until the models are loaded, also after martlet-host warm.
- Route ID:
martlet.gateway.voice-recognition.v1 - Path:
/martlet/v1/inference/voice-recognition - Contract:
martlet.voice-recognition-relayversion1.0 - Relay:
Martlet.Gateway.VoiceRecognition - Role:
GatewayRole.Voice(paired computers and friends) - Model ID:
wespeaker-en-voxceleb-resnet34-lm, revisionspeaker-recongition-models(the sherpa-onnx release tag), SHA-256e9848563da86f263117134dfd7ad63c92355b37de492b55e325400c9d9c39012 - Port:
127.0.0.1:50091
Each request has one operation and gets one JSON answer.
status:
{"operation":"status"}{"state":"ready","provider":"cuda","model":"wespeaker-en-voxceleb-resnet34-lm","segmentation":"pyannote-segmentation-3-0","accelerator":"gpu","threads":4,"runtime":{"sherpa-onnx":"1.13.8+cuda12.cudnn9.onnxruntime1.28.2","numpy":"2.5.3","onnxruntime":"1.28.2"}}state is ready or loading. While the service loads, provider is the
provider it tries. When the service does not answer yet (its container starts,
or restarts after a failed load), the relay answers
{"state":"loading","model":"wespeaker-en-voxceleb-resnet34-lm"} without a
provider.
analyze says who spoke in up to a minute of 16 kHz mono PCM16
(little-endian), as SpeakerEngine.Analyze does:
{"operation":"analyze","sample_rate":16000,"pcm16_base64":"..."}{"speakers":[{"local":0,"voiceprint":[0.0123,...],"clean_seconds":2.4,"start":0.5,"end":3.1}],"voices":1,"overlap":false,"whole":null,"speech_seconds":3.0,"milliseconds":42}-
speakers: the people with at least 2 seconds of clean speech, most first. Eachvoiceprinthas 256 numbers and length 1. It is the average of up to three clean stretches of at most 8 seconds each. Stretches that disagree (cosine below 0.45) are left out together. -
voices: how many voices segmentation heard.overlap: two of them talked over each other for more than 0.2 seconds. -
whole: a voiceprint of all the audio, only when nobody has enough clean speech and the audio is at least 1 second long; otherwisenull. -
speech_seconds: the seconds of speech. Times are rounded to 0.01 s as the desktop rounds them.
voiceprint makes one voiceprint of all the audio, as
SpeakerEngine.Voiceprint does. It is null for less than 1 second:
{"operation":"voiceprint","sample_rate":16000,"pcm16_base64":"..."}{"voiceprint":[0.0123,...],"milliseconds":12}Each voiceprint number is the float32 value written with the fewest digits that read back as the same float32.
Errors: request.invalid (another sample rate, odd or empty audio, other
fields), request.too_large (more than a minute), worker.unavailable (the
service is loading or not answering) and worker.failed.
tests/Martlet.Desktop.Tests/VoiceRecognitionHostTests.cs keeps the host and the
desktop the same:
- The host's model files, their sizes, SHA-256 and URLs, and the thresholds are the desktop build's.
-
workers/voice-recognition/tests/clean_cases.jsonholds clean-speech and rounding cases that bothSpeakerEngine.Cleanand .NET'sMath.Roundand the host's port must answer the same way. -
The_hosts_port_answers_like_this_pc(opt-in) synthesizes speech with two of Windows' voices: one voice alone, two taking turns, two talking over each other, a voice that comes back, and audio too short for a voiceprint. It runs the desktop engine and the host's port on the same audio and compares every answer. SetMARTLET_VOICE_RECOGNITION_PYTHONto a Python with sherpa-onnx 1.13.8 to run the port on this PC, orMARTLET_VOICE_RECOGNITION_IMAGEto the built image to run it in Docker (MARTLET_VOICE_RECOGNITION_GPU=1for the graphics card). - The MCP tool
voice_recognition_engine_checksends the same kind of speech through the whole path: the desktop's client, a real gateway, this role's relay and a running service. WithmartletDirectoryit compares the answers with this PC's engine. See MCP.
On the processor the answers are the same: the same voices, the same times to 0.01 s and voiceprints with a cosine of 1.0000000. With the Windows wheel of sherpa-onnx (the same ONNX Runtime build as the desktop's) every voiceprint number is the same to the last bit; in the Linux images each number is within 0.000002 of the desktop's. On the graphics card the voiceprints differ a little more, and the test asks for a cosine of at least 0.995 and times within 0.05 s.
The role listens only on loopback. The Martlet gateway is the only LAN entry point. Paired computers send the speech Martlet hears, one utterance of up to a minute at a time. The service analyzes it in memory, clears the samples after each request and does not write or log audio, voiceprints or results.
Using the role means accepting these licenses:
- sherpa-onnx (and its CUDA build): Apache-2.0.
- ONNX Runtime: MIT.
- NumPy: BSD-3-Clause.
- WeSpeaker ResNet34-LM model: CC BY 4.0.
- pyannote segmentation 3.0 model and its ONNX export: MIT.
- With the
gpuaccelerator: NVIDIA CUDA and cuDNN libraries, NVIDIA's license.
workers/voice-recognition/THIRD-PARTY-NOTICES.txt lists each with its source.
Martlet: download · repository · changelog · issues
These pages come from docs/wiki in the repository. To suggest a change, open an issue or a pull request there.
- Home
- Accounts and households
- Accounts and Household
- Android phones and tablets: what it takes, and the plan
- Martlet's API for other apps and scripts
- App Guides
- App Settings and Updates
- App guides: game and app knowledge from the web
- Architecture
- Bounded PCM playback
- Audio dependency inventory and notices
- Avatar guide: Live2D, VRM and speech animation
- V01a explicit microphone capture
- Chatterbox voice engines
- Cleaning up disk space
- One Martlet on all your computers
- Companion controls and behavior requirements
- Components, jobs and placement (design)
- Live conversation
- Creations
- Decision map: which file owns each decision
- Deep research: web search and long research jobs
- The desktop app: updates, notification area, exiting and appearance
- Linux and macOS desktop companion: research, decision and plan
- Developer Guide
- Dia voice engine
- Diagnostics
- Discord
- Architecture and provider contracts
- Discord
- Memory (P03a/P03b/P03c)
- Singing
- Desktop troubleshooting and local support
- Recognizing people by voice, and Parakeet
- Echo cancellation
- ElevenLabs voice: your cloned voice with tones
- F5 worker and reference-voice foundation
- FAQ
- First Steps
- Game state plan: implementation history
- Glossary: one name for each concept
- GPT-SoVITS voice
- Hosted Thinking: cloud models when Thinking can't run on this PC
- Installation and support
- Installing Martlet
- iOS and iPadOS: what it takes, and the plan
- Repository instructions for coding agents
- Repository knowledge base
- Knowledge base maintenance
- GitHub Wiki mirror
- Linux and Mac
- Listening and Voice ID
- Local model apps
- Lorebooks
- macOS: what it takes, and the plan
- Martlet MCP Server
- MCP in Martlet
- MCP: The app's window
- MCP: Apps, home and memory
- MCP: Characters
- MCP: Diagnostics and logs
- MCP: Computers, network and accounts
- MCP: Other
- MCP: Tool permissions
- MCP pages
- MCP: Server and protocol internals
- MCP: Settings
- MCP: Start here
- MCP: Thinking and models
- MCP: Voice and listening
- Memory
- Messaging apps
- Model catalog: sources, conflicts and design
- Motion host role
- Multiple Computers
- Your Martlet network
- OCR host role
- Share your language models: the OpenAI-compatible endpoint
- Packaging
- Perception worker contracts
- Personality and Characters
- Picture making
- Pictures and Creations
- Picture making host role
- Platforms: what each device can do
- Prerequisites: what Martlet bundles, installs for you, or needs from you
- Privacy and Safety
- Reading the text on your screen
- Wiki source
- Recommendation design: ask three questions, plan for three situations
- Recommended setups: one machine to unlimited budget
- Releasing
- Repository Layout
- Research and provenance ledger
- Resource footprints
- Roadmap
- Watch my screen: screen-aware commentary
- Search engine
- Image and audio models: who sees, who hears, who answers
- Setting Up a Host
- Setup, Windows credentials and local audio
- Sharing with Friends
- Singing
- Smart Home
- Smart home and cameras
- Source Projects
- Talking to Martlet
- Telegram and WhatsApp
- The Character
- Thinking
- Tools and MCP
- Troubleshooting
- Martlet desktop UI design
- User stories and target flows
- Voice activity detection
- Validating changes
- Validation and Testing
- Vision
- Voice latency: from you stopping talking to Martlet's voice
- Voice recognition host role
- Multi-engine voice setup and comparison
- Voices
- The welcome wizard
- XTTS-v2 voice engine