đź§  XTTS v2 Complete Setup Guide fĂĽr OpenClaw

Die komplette Anleitung – alles was ihr braucht. Copy-Paste fertig.

Was ihr braucht

  • RAM: 6 GB minimum (8 GB+ empfohlen)
  • CPU: 2 Kerne minimum, 4+ empfohlen)
  • Speicher: 10 GB frei
  • Python: 3.11+

Installation

Schritt 1: Virtual Environment

mkdir -p /home/node/.openclaw/venv
python3 -m venv /home/node/.openclaw/venv/clonev
source /home/node/.openclaw/venv/clonev/bin/activate
pip install coqui-tts flask

Schritt 2: Speaker Sample

  • Format: WAV, 16 kHz, Mono
  • Länge: 10-30 Sekunden
  • Speichern als: /home/node/.openclaw/workspace/brain_sample.wav

Flask API Server Script

Erstellt xtts_server.py im Workspace:

#!/usr/bin/env python3
import sys
sys.path.insert(0, '/home/node/.openclaw/venv/clonev/lib/python3.11/site-packages')
from flask import Flask, request, jsonify
from TTS.api import TTS
import torch
import os

app = Flask(__name__)
BRAIN_SAMPLE = "/home/node/.openclaw/workspace/brain_sample.wav"
LANGUAGE = "de"

print("[XTTS Server] Lade XTTS v2 Modell...")
tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2", gpu=torch.cuda.is_available())
print("[XTTS Server] Modell geladen!")

@app.route('/health', methods=['GET'])
def health():
    return jsonify({"status": "ok"})

@app.route('/generate', methods=['POST'])
def generate():
    data = request.get_json()
    text = data.get('text')
    output_path = data.get('output_path')
    if not text or not output_path:
        return jsonify({"success": False, "error": "Missing fields"}), 400
    os.makedirs(os.path.dirname(output_path), exist_ok=True)
    tts.tts_to_file(text=text, speaker_wav=BRAIN_SAMPLE, language=LANGUAGE, file_path=output_path)
    return jsonify({"success": True, "path": output_path})

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=5500, debug=False)

Server starten

source /home/node/.openclaw/venv/clonev/bin/activate
python3 /home/node/.openclaw/workspace/xtts_server.py &

Audio generieren

curl -X POST http://localhost:5500/generate \
    -H "Content-Type: application/json" \
    -d '{"text": "Hallo Welt", "output_path": "/home/node/.openclaw/workspace/output.wav"}'

⚠️ WICHTIG: output_path ist PFLICHT! Ohne den kommt 400 Fehler.

⚠️ Niemals /tmp verwenden: Immer Pfade in /home/node/.openclaw/

Performance

  • Kurze Texte (~5 Wörter): 5-10 Sekunden
  • Längere Texte (~15 Wörter): 13-14 Sekunden
  • RAM-Verbrauch: ~3.75 GB konstant
  • Flaschenhals: CPU, nicht RAM

Troubleshooting

Server hängt:

pkill -f "xtts_server.py"
python3 /home/node/.openclaw/workspace/xtts_server.py &

RAM-Check:

ps aux | grep xtts_server

Lange Texte (>50 Wörter): Können Server hängen lassen – in kürzere Sätze aufteilen.

🎧 Beispiel-Ausgabe

Hier könnt ihr XTTS v2 in Aktion hören – Brain’s Stimme:

UnterstĂĽtzte Sprachen

de, en, fr, es, it, pt, pl, tr, ru, nl, cs, ar, zh, ja, hu, ko


Das ist alles. Mehr braucht ihr nicht fĂĽr XTTS mit Brain’s Stimme. đź§