Labsco
digitarald logo

Chatterbox TTS

β˜… 12

from digitarald

Generates text-to-speech audio with automatic playback using the Chatterbox TTS model.

πŸ”₯πŸ”₯πŸ”₯βœ“ VerifiedFreeQuick setup

Chatterbox TTS MCP Server

A simplified Model Context Protocol (MCP) server that provides text-to-speech generation with automatic playback using the Chatterbox TTS model. The server loads the model automatically on first use and provides real-time progress notifications to keep users informed throughout the process.

Overview

This MCP server exposes Chatterbox TTS functionality through a single, streamlined tool that generates speech from text and plays it automatically. The server handles model loading, progress reporting, temporary file management, and audio playback seamlessly.

Features

Single Tool: speak_text

The speak_text tool provides complete text-to-speech functionality:

  • Parameters:

    • text (required): The text to convert to speech
    • exaggeration (optional): Controls expressiveness (0.0-1.0, default 0.5)
    • cfg_weight (optional): Controls classifier-free guidance (0.0-1.0, default 0.5)
  • Features:

    • Automatic model loading with progress notifications
    • Generates speech using temporary files (auto-cleanup)
    • Plays audio automatically on macOS using afplay
    • Real-time progress updates during all phases:
      • Model initialization and loading
      • Speech generation
      • Audio playback

Resource: chatterbox://model-info

Get information about the TTS model status and device capabilities:

  • Model loading status (loaded/not loaded)
  • Device information (MPS/CUDA/CPU)
  • Hardware acceleration availability

Progress Notifications

The server provides detailed progress notifications throughout the speech generation process:

  1. Model Loading Phase:

    • "Loading Chatterbox TTS model..."
    • "Initializing PyTorch device..."
    • "Loading model weights..."
    • "Model loaded successfully!"
  2. Speech Generation Phase:

    • "Starting speech generation..."
    • "Speech generated, saving to temporary file..."
  3. Playback Phase:

    • "Playing audio..."
    • "Audio playback completed!"
  4. Status Updates:

    • Device selection (MPS/CUDA/CPU)
    • Voice prompt usage when applicable
    • Success/error messages

Technical Details

Device Support

  • Apple Silicon (M1/M2/M3/M4): Uses MPS acceleration when available
  • NVIDIA GPUs: Uses CUDA when available
  • CPU fallback: Works on any system

Audio Processing

  • Uses temporary files for audio storage
  • Automatic cleanup after playback
  • WAV format output
  • High-quality audio generation

Model Management

  • Model loads once on first use
  • Shared across all subsequent requests
  • Thread-safe loading with progress tracking
  • Automatic device detection and optimization

File Structure

chatterbox-mcp/
β”œβ”€β”€ chatterbox_mcp_server.py    # MCP server implementation
└── README.md                   # This documentation

Development

Key Improvements in This Version

  1. Simplified Interface: Single speak_text tool instead of multiple tools
  2. Automatic Playback: No need to manually play generated files
  3. Progress Notifications: Real-time updates on model loading and generation
  4. Persistent Audio Storage: Audio files are stored with configurable automatic cleanup
  5. Better Error Handling: Comprehensive error reporting and recovery
  6. Streamlined Workflow: One command generates and plays speech