← Back to Plugins
Tools

Tts Piper

sdamarketing By sdamarketing 👁 405 views ▲ 0 votes

Local TTS plugin for OpenClaw using Piper - bilingual Russian/English

GitHub

Install

npm install
npm

Configuration Example

{
  "plugins": {
    "tts-piper": {
      "enabled": true,
      "serverUrl": "http://127.0.0.1:18794",
      "defaultVoice": "auto"
    }
  },
  "messages": {
    "tts": {
      "provider": "piper"
    }
  }
}

README

# TTS Piper Plugin for OpenClaw

Local text-to-speech plugin using Piper - offline, bilingual (Russian/English).

## Features

- **100% Offline** - No internet required after setup
- **Bilingual** - Automatic language detection (Russian/English)
- **Fast** - Local synthesis, no API latency
- **Free** - No API costs

## Voices

| Language | Voice | Quality |
|----------|-------|---------|
| 🇷🇺 Russian | Dmitri | Medium |
| 🇬🇧 English | Lessac | Medium |

## Requirements

1. Piper TTS models installed:
```bash
mkdir -p ~/.local/share/piper
cd ~/.local/share/piper

# Russian model
wget https://huggingface.co/rhasspy/piper-voices/resolve/main/ru/ru_RU/dmitri/medium/ru_RU-dmitri-medium.onnx
wget https://huggingface.co/rhasspy/piper-voices/resolve/main/ru/ru_RU/dmitri/medium/ru_RU-dmitri-medium.onnx.json

# English model
wget https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_US/lessac/medium/en_US-lessac-medium.onnx
wget https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_US/lessac/medium/en_US-lessac-medium.onnx.json
```

2. Piper TTS server running:
```bash
pip install piper-tts pathvalidate
python3 ~/.local/bin/piper-tts-openclaw.py
```

## Installation

```bash
cd ~/.openclaw/extensions
git clone https://github.com/sdamarketing/tts-piper.git
cd tts-piper
npm install
npm run build
```

## Configuration

Add to `~/.openclaw/openclaw.json`:

```json
{
  "plugins": {
    "tts-piper": {
      "enabled": true,
      "serverUrl": "http://127.0.0.1:18794",
      "defaultVoice": "auto"
    }
  },
  "messages": {
    "tts": {
      "provider": "piper"
    }
  }
}
```

### Options

| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `enabled` | boolean | `true` | Enable/disable plugin |
| `serverUrl` | string | `http://127.0.0.1:18794` | Piper TTS server URL |
| `defaultVoice` | string | `auto` | Default voice (`auto`, `ru`, `en`) |
| `fallbackToEdge` | boolean | `true` | Fallback to Edge TTS if Piper unavailable |

## Language Detection

The plugin automatically detects the language based on character analysis:
- Cyrillic characters → Russian voice (Dmitri)
- Latin characters → English voice (Lessac)

You can override this by setting `defaultVoice` to `ru` or `en`.

## Systemd Service

Create a systemd service for the Piper TTS server:

```bash
cat > ~/.config/systemd/user/piper-tts.service << 'EOF'
[Unit]
Description=Piper TTS Server for OpenClaw
After=network.target

[Service]
Type=simple
WorkingDirectory=%h/.local/bin
ExecStart=/usr/bin/python3 %h/.local/bin/piper-tts-openclaw.py
Restart=always
RestartSec=10

[Install]
WantedBy=default.target
EOF

systemctl --user daemon-reload
systemctl --user enable piper-tts
systemctl --user start piper-tts
```

## Testing

```bash
# Test server
curl http://127.0.0.1:18794/health

# Test synthesis
curl -X POST http://127.0.0.1:18794/v1/text-to-speech/test \
  -H "Content-Type: application/json" \
  -d '{"text":"Привет, это тест"}' \
  -o test.wav
  
aplay test.wav
```

## License

MIT
tools

Comments

Sign in to leave a comment

Loading comments...