← 返回
沟通协作

Voice Reply

Local text-to-speech using Piper voices via sherpa-onnx. 100% offline, no API keys required. Use when user asks for a voice reply, audio response, spoken answer, or wants to hear something read aloud. Supports multiple languages including German (thorsten) and English (ryan) voices. Outputs Telegram-compatible voice notes with [[audio_as_voice]] tag.
使用 sherpa-onnx 的 Piper 语音实现本地文字转语音。100% 离线,无需 API 密钥。适用于用户请求语音回复、音频回复、口述答案或需要朗读的场景。支持多语言,包括德语 (thorsten) 和英语 (ryan) 语音。输出兼容 Telegram 的语音笔记,使用 [[audio_as_voice]] 标签。
stolot0mt0m
沟通协作 clawhub v1.0.0 1 版本 98416.7 Key: 无需
★ 9
Stars
📥 5,352
下载
💾 1,256
安装
1
版本
#latest

概述

Voice Reply

Generate voice audio replies using local Piper TTS via sherpa-onnx. Completely offline, no cloud APIs needed.

Features

  • 100% Local - No internet connection required after setup
  • No API Keys - Free to use, no accounts needed
  • Multi-language - German and English voices included
  • Telegram Ready - Outputs voice notes that display as bubbles
  • Auto-detect Language - Automatically selects voice based on text

Prerequisites

  1. sherpa-onnx runtime installed
  2. Piper voice models downloaded
  3. ffmpeg for audio conversion

Installation

Quick Install

cd scripts
sudo ./install.sh

Manual Installation

1. Install sherpa-onnx

sudo mkdir -p /opt/sherpa-onnx
cd /opt/sherpa-onnx
curl -L -o sherpa.tar.bz2 "https://github.com/k2-fsa/sherpa-onnx/releases/download/v1.12.23/sherpa-onnx-v1.12.23-linux-x64-shared.tar.bz2"
sudo tar -xjf sherpa.tar.bz2 --strip-components=1
rm sherpa.tar.bz2

2. Download Voice Models

sudo mkdir -p /opt/piper-voices
cd /opt/piper-voices

# German - thorsten (medium quality, natural male voice)
curl -L -o thorsten.tar.bz2 "https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-piper-de_DE-thorsten-medium.tar.bz2"
sudo tar -xjf thorsten.tar.bz2 && rm thorsten.tar.bz2

# English - ryan (high quality, clear US male voice)
curl -L -o ryan.tar.bz2 "https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-piper-en_US-ryan-high.tar.bz2"
sudo tar -xjf ryan.tar.bz2 && rm ryan.tar.bz2

3. Install ffmpeg

sudo apt install -y ffmpeg

4. Set Environment Variables

Add to your OpenClaw service or shell:

export SHERPA_ONNX_DIR="/opt/sherpa-onnx"
export PIPER_VOICES_DIR="/opt/piper-voices"

Usage

{baseDir}/bin/voice-reply "Text to speak" [language]

Parameters

ParameterDescriptionDefault
---------------------------------
textThe text to convert to speech(required)
languagede for German, en for Englishauto-detect

Examples

# German (explicit)
{baseDir}/bin/voice-reply "Hallo, ich bin dein Assistent!" de

# English (explicit)
{baseDir}/bin/voice-reply "Hello, I am your assistant!" en

# Auto-detect (detects German from umlauts and common words)
{baseDir}/bin/voice-reply "Guten Tag, wie geht es dir?"

# Auto-detect (defaults to English)
{baseDir}/bin/voice-reply "The weather is nice today."

Output Format

The script outputs two lines that OpenClaw processes for Telegram:

[[audio_as_voice]]
MEDIA:/tmp/voice-reply-output.ogg
  • [[audio_as_voice]] - Tag that tells Telegram to display as voice bubble
  • MEDIA:path - Path to the generated OGG Opus audio file

Available Voices

LanguageVoiceQualityDescription
---------------------------------------
German (de)thorstenmediumNatural male voice, clear pronunciation
English (en)ryanhighClear US male voice, professional tone

Adding More Voices

Browse available Piper voices at:

  • https://rhasspy.github.io/piper-samples/
  • https://github.com/k2-fsa/sherpa-onnx/releases/tag/tts-models

Download and extract to $PIPER_VOICES_DIR, then modify the script to include the new voice.

Troubleshooting

"TTS binary not found"

Ensure SHERPA_ONNX_DIR is set and contains bin/sherpa-onnx-offline-tts.

"Failed to generate audio"

Check that voice model files exist: *.onnx, tokens.txt, espeak-ng-data/

Audio plays as file instead of voice bubble

Ensure the output includes [[audio_as_voice]] tag on its own line before the MEDIA: line.

Credits

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-28 10:29 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

communication-collaboration

imap-smtp-email

gzlicanyi
使用IMAP/SMTP读取和发送邮件;检查新/未读邮件、获取内容、搜索邮箱、标记已读/未读、发送带附件的邮件。支持...
★ 113 📥 52,385
communication-collaboration

Slack

steipete
当需要通过 slack 工具从 Clawdbot 控制 Slack 时使用,包括在频道或私信中回复消息或置顶/取消置顶项目。
★ 157 📥 47,670
communication-collaboration

Gmail

byungkyu
Gmail API 集成,托管 OAuth,支持读取、发送和管理邮件、线程、标签及草稿,适用于需要与 Gmail 交互的场景。
★ 72 📥 37,718