---
title: "FallbackTTS | Micdrop"
description: "The FallbackTTS class provides automatic failover between multiple TTS providers for improved reliability."
url: "https://micdrop.dev/docs/ai-integration/fallback-strategies/tts-fallback"
---

*   [Getting Started](/docs/getting-started)
*   [Client (Browser)](/docs/client)
    
    *   [Installation](/docs/client/installation)
    *   [React Hooks](/docs/client/react-hooks)
    *   [Start/Stop Call](/docs/client/start-stop-call)
    *   [Pause/Resume Call](/docs/client/pause-resume-call)
    *   [Mute/Unmute Call](/docs/client/mute-unmute-call)
    *   [Call State](/docs/client/call-state)
    *   [Display Conversation Messages](/docs/client/display-conversation-messages)
    *   [Handling Tool Calls](/docs/client/handling-tool-calls)
    *   [Device Management](/docs/client/devices-management)
    *   [Voice Activity Detection (VAD)](/docs/client/vad)
    *   [Error Handling](/docs/client/error-handling)
    *   Utility Classes
        
        *   [Mic](/docs/client/utility-classes/mic)
        *   [MicdropClient](/docs/client/utility-classes/micdrop-client)
        *   [MicRecorder](/docs/client/utility-classes/mic-recorder)
        *   [Speaker](/docs/client/utility-classes/speaker)
        
    
*   [Server (Node.js)](/docs/server)
    
    *   [Installation](/docs/server/installation)
    *   [With Fastify](/docs/server/with-fastify)
    *   [With NestJS](/docs/server/with-nestjs)
    *   [Auth and Parameters](/docs/server/auth-and-parameters)
    *   [First Message](/docs/server/first-message)
    *   [Save Messages](/docs/server/save-messages)
    *   [Resume a Conversation](/docs/server/resume-conversation)
    *   [Recording Audio](/docs/server/recording-audio)
    *   [Error Handling](/docs/server/error-handling)
    *   [Tools](/docs/server/tools)
    *   [Extract Value from Answer](/docs/server/extract)
    *   [Auto End Call](/docs/server/auto-end-call)
    *   [Semantic Turn Detection](/docs/server/semantic-turn-detection)
    *   [Noise Filtering](/docs/server/noise-filtering)
    *   [Micdrop Protocol](/docs/server/protocol)
    
*   [AI Integrations](/docs/ai-integration)
    
    *   Provided Integrations
        
        *   [AI SDK](/docs/ai-integration/provided-integrations/ai-sdk)
        *   [Cartesia](/docs/ai-integration/provided-integrations/cartesia)
        *   [ElevenLabs](/docs/ai-integration/provided-integrations/elevenlabs)
        *   [Gladia](/docs/ai-integration/provided-integrations/gladia)
        *   [Gradium](/docs/ai-integration/provided-integrations/gradium)
        *   [Kokoro](/docs/ai-integration/provided-integrations/kokoro)
        *   [Mistral](/docs/ai-integration/provided-integrations/mistral)
        *   [OpenAI](/docs/ai-integration/provided-integrations/openai)
        *   [Piper](/docs/ai-integration/provided-integrations/piper)
        *   [Pocket TTS](/docs/ai-integration/provided-integrations/pocket-tts)
        *   [Whisper](/docs/ai-integration/provided-integrations/whisper)
        
    *   Custom Integrations
        
        *   [Agent (LLM)](/docs/ai-integration/custom-integrations/custom-agent)
        *   [Speech-to-Text (STT)](/docs/ai-integration/custom-integrations/custom-stt)
        *   [Text-to-Speech (TTS)](/docs/ai-integration/custom-integrations/custom-tts)
        
    *   Fallback Strategies
        
        *   [FallbackAgent](/docs/ai-integration/fallback-strategies/agent-fallback)
        *   [FallbackSTT](/docs/ai-integration/fallback-strategies/stt-fallback)
        *   [FallbackTTS](/docs/ai-integration/fallback-strategies/tts-fallback)
        
    *   [Local Models](/docs/ai-integration/local-models)
        
        *   [Choosing the Models](/docs/ai-integration/local-models/choosing-models)
        *   [Latency and Memory](/docs/ai-integration/local-models/performance)
        *   [Explorations](/docs/ai-integration/local-models/explorations)
        
    *   [IA Vocale Souveraine 🇫🇷🇪🇺](/docs/ai-integration/sovereign-voice-ai)
    

[Micdrop](/) › [Documentation](/docs/getting-started)

# FallbackTTS

The `FallbackTTS` class provides automatic failover between multiple TTS providers for improved reliability. When one provider fails after exhausting its retries, it automatically switches to the next provider in the list.

## Features

*   **Automatic failover**: Seamlessly switches between providers when failures occur
*   **Text buffering**: Retains text chunks during failures and replays them to the next provider
*   **Circular rotation**: Cycles through providers indefinitely until speech synthesis succeeds
*   **Zero configuration**: Works with any TTS implementation
*   **Cancellation support**: Properly forwards cancel() calls to the active provider

## Usage

```
import { FallbackTTS } from '@micdrop/server'import { ElevenLabsTTS } from '@micdrop/elevenlabs'import { CartesiaTTS } from '@micdrop/cartesia'
// Create a fallback TTS with multiple providersconst tts = new FallbackTTS({  factories: [    // Primary provider: ElevenLabs with low retry count    () =>      new ElevenLabsTTS({        apiKey: process.env.ELEVENLABS_API_KEY || '',        voiceId: process.env.ELEVENLABS_VOICE_ID || '',        maxRetry: 2, // Fail faster to switch to backup      }),    // Backup provider: Cartesia    () =>      new CartesiaTTS({        apiKey: process.env.CARTESIA_API_KEY || '',        modelId: 'sonic-turbo',        voiceId: process.env.CARTESIA_VOICE_ID || '',        maxRetry: 3,      }),  ],})
// Use with MicdropServerconst server = new MicdropServer(socket, {  tts,  // ... other options})
```

## Options

Option

Type

Description

`factories`

`Array<() => TTS>`

Array of factory functions that create TTS instances

## How It Works

1.  **Initialization**: Starts with the first provider in the list
2.  **Normal operation**: Forwards all text to the current provider and emits audio chunks
3.  **On failure**: When a provider emits the `Failed` event:
    *   Destroys the current provider
    *   Moves to the next provider (wraps around to first if at end)
    *   Replays buffered text chunks to the new provider
4.  **Logging**: Inherits logger configuration and applies it to child providers

[Previous← FallbackSTT](/docs/ai-integration/fallback-strategies/stt-fallback)[NextLocal Models →](/docs/ai-integration/local-models)

On this page

*   [Features](#features)
*   [Usage](#usage)
*   [Options](#options)
*   [How It Works](#how-it-works)
