360 Secure SkillHub
360 安全技能中心

Whisper Piper Voice

在本地部署并运行单端口 HTTP 服务,集成 faster-whisper 语音转写与 Piper 文本转语音:/transcribe 接收音频返回 JSON 文本与语种,/speak 接收文本输出 ogg/Opus 语音。支持 CPU 或 NVIDIA CUDA,可配置模型、说话人与语速,运行时不上传数据到云端,安装阶段需下载 Piper 二进制与语音模型。

danielgrobelny
danielgrobelny
热度 37.77
最近更新 2026-05-11 17:35:58
分类:自动化依赖:代码执行 / 读写文件应用场景:API 集成 / 自动化脚本 / 工作流

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add whisper-piper-voice
Metadata
name
whisper-piper-voice
description
Set up and run a local voice pipeline combining Whisper STT (speech-to-text) and Piper TTS (text-to-speech) as a single HTTP server. Use when asked to set up voice capabilities, transcribe audio, generate speech, configure STT/TTS, or build a voice assistant pipeline. Handles both directions — audio-to-text and text-to-audio — on a single port. Runs fully offline on CPU or GPU (NVIDIA CUDA). NOT for cloud-based TTS (ElevenLabs, Google TTS) — this is 100% local and free.

Whisper + Piper Voice Pipeline

Local STT (speech-to-text) and TTS (text-to-speech) as a single HTTP server. Zero cloud dependencies.

Architecture

Audio In → POST /transcribe → Whisper (faster-whisper) → JSON {text, language}
Text In  → POST /speak       → Piper TTS → ffmpeg → audio/ogg (Opus)

Both endpoints run in one Python process on one port (default: 9998).

Quick Start

  1. Install dependencies:
python3 -m venv ~/whisper-env && source ~/whisper-env/bin/activate
pip install faster-whisper
apt install ffmpeg  # or brew install ffmpeg on macOS
  1. Download Piper + a voice:
mkdir -p ~/piper && cd ~/piper
wget https://github.com/rhasspy/piper/releases/latest/download/piper_linux_x86_64.tar.gz
tar xzf piper_linux_x86_64.tar.gz
mkdir voices && cd voices
wget https://huggingface.co/rhasspy/piper-voices/resolve/main/de/de_DE/thorsten_emotional/medium/de_DE-thorsten_emotional-medium.onnx
wget https://huggingface.co/rhasspy/piper-voices/resolve/main/de/de_DE/thorsten_emotional/medium/de_DE-thorsten_emotional-medium.onnx.json
  1. Run the server (scripts/voice-server.py):
python3 voice-server.py --port 9998 \
  --whisper-model small --whisper-device cpu \
  --piper-bin ~/piper/piper/piper \
  --piper-model ~/piper/voices/de_DE-thorsten_emotional-medium.onnx

API

Transcribe (audio → text):

curl -X POST -F "file=@message.ogg" http://HOST:9998/transcribe
# {"text": "Hallo Welt", "language": "de"}

Speak (text → audio):

curl -X POST -H "Content-Type: application/json" \
  -d '{"text": "Hallo Welt", "speaker": "4"}' \
  http://HOST:9998/speak -o response.ogg

Configuration

Flag Default Description
--port 9998 Server port
--whisper-model small tiny/base/small/medium/large-v3
--whisper-device cpu cpu or cuda
--piper-bin (required) Path to piper binary
--piper-model (required) Path to .onnx voice file
--piper-speaker 4 Speaker ID (multi-speaker models)
--speed 0.9 TTS speed (lower = faster)

Choosing Models

Whisper: small for CPU (good balance), medium for GPU (best quality without large-v3 overhead).

Piper voices: Browse https://rhasspy.github.io/piper-samples/ — download .onnx + .onnx.json files.

Full Setup Guide

Read references/setup-guide.md for systemd service config, all voice options, model comparison table, and OpenClaw integration details.