# VoiceStudio Default TTS Engine and How to Change It

> Discover the default TTS engine in VoiceStudio and learn how to easily change it. Customize your voice output with alternative engines like VoxCPM2 or IndexTTS for a personalized experience.

- Repository: [Palash Debnath/VoiceStudio](https://github.com/debpalash/VoiceStudio)
- Tags: how-to-guide
- Published: 2026-09-09

---

**VoiceStudio ships with OmniVoice as the default text-to-speech engine, utilizing the `OmniVoiceBackend` class (ID `"omnivoice"`), and you can switch to alternative engines like VoxCPM2 or IndexTTS by setting the `OMNIVOICE_TTS_BACKEND` environment variable or using the Settings UI.**

VoiceStudio is an open-source AI voice generation platform that supports multiple TTS backends through a unified adapter pattern. The default engine configuration is defined in the [`backend/services/tts_backend.py`](https://github.com/debpalash/VoiceStudio/blob/main/backend/services/tts_backend.py) module, where the system reads environment variables to determine which backend adapter to instantiate at runtime. Understanding this configuration mechanism allows you to optimize voice quality, latency, and resource usage by selecting the most appropriate engine for your hardware.

## What Is the Default TTS Engine in VoiceStudio?

VoiceStudio uses **OmniVoice** as its default TTS engine. According to the source code in [`backend/services/tts_backend.py`](https://github.com/debpalash/VoiceStudio/blob/main/backend/services/tts_backend.py), the system checks the `OMNIVOICE_TTS_BACKEND` environment variable at startup, defaulting to the string `"omnivoice"` when the variable is unset (around line 13). This ID maps to the `OmniVoiceBackend` class, which implements the standard TTS interface for voice generation, model loading, and audio synthesis.

The current active engine ID can be retrieved programmatically using the `active_backend_id()` function:

```python
from services.tts_backend import active_backend_id

# Returns "omnivoice" by default, or the custom ID you've configured

current_engine = active_backend_id()
print(f"Active TTS engine: {current_engine}")

```

## How to Change the TTS Engine in VoiceStudio

You can switch between available TTS engines using two methods: environment variable configuration for headless deployments or the Settings UI for interactive use.

### Method 1: Configure the OMNIVOICE_TTS_BACKEND Environment Variable

The most direct way to change engines is by setting the `OMNIVOICE_TTS_BACKEND` environment variable to a valid backend ID before starting VoiceStudio. Available engine IDs include `"omnivoice"`, `"voxcpm2"`, and `"indextts"`.

**Bash/Linux:**

```bash
export OMNIVOICE_TTS_BACKEND=voxcpm2

# Now start VoiceStudio

python main.py

```

**Windows PowerShell:**

```powershell
$env:OMNIVOICE_TTS_BACKEND="indextts"

# Now start VoiceStudio

python main.py

```

After setting this variable, the `get_active_tts_backend()` function will instantiate the corresponding backend class instead of the default `OmniVoiceBackend`.

### Method 2: Use the Settings UI

For desktop or web interface users, navigate to **Settings → Engine → TTS Engine**. The dropdown menu displays all registered backends. Selecting an alternative engine updates the configuration and triggers a backend reload. The UI effectively writes the selected ID to the same environment variable or internal configuration store that `active_backend_id()` reads from.

## Backend Implementation and Caching

The engine switching mechanism is implemented in [`backend/services/tts_backend.py`](https://github.com/debpalash/VoiceStudio/blob/main/backend/services/tts_backend.py) (around lines 2696–2700). When you change engines, VoiceStudio performs the following sequence:

1. **Unload**: Calls `unload()` on the current backend instance to free VRAM and terminate sidecar processes.
2. **Reset**: Clears the cached backend instance via `reset_active_backend()`.
3. **Instantiate**: Creates a fresh instance of the newly selected backend class when `get_active_tts_backend()` is next called.

This ensures clean resource management and prevents memory leaks when switching between resource-intensive models.

## Practical Code Examples

### Get the Current Backend Instance

```python
from services.tts_backend import get_active_tts_backend

# Returns an initialized backend object (OmniVoiceBackend by default)

tts = get_active_tts_backend()
audio_buffer = tts.generate("Hello, world!")

```

### Programmatically Switch Engines

```python
import os
from services.tts_backend import reset_active_backend, get_active_tts_backend

# Change engine at runtime

os.environ["OMNIVOICE_TTS_BACKEND"] = "indextts"

# Clear the cached instance to force recreation

reset_active_backend()

# Verify the switch

new_backend = get_active_tts_backend()
print(new_backend.id)  # Output: indextts

```

### List Available Engine IDs

While the specific registry lookup depends on the backend definitions in [`backend/services/tts_backend.py`](https://github.com/debpalash/VoiceStudio/blob/main/backend/services/tts_backend.py), you can typically discover available engines by inspecting the backend registry or checking the source for classes extending the base backend interface (such as `VoxCPM2Backend` and `IndexTTSBackend`).

## Summary

- **Default Engine**: OmniVoice (`OmniVoiceBackend`, ID `"omnivoice"`) configured via `OMNIVOICE_TTS_BACKEND` environment variable.
- **Configuration Location**: [`backend/services/tts_backend.py`](https://github.com/debpalash/VoiceStudio/blob/main/backend/services/tts_backend.py) (line 13 for defaults, lines 2696–2700 for active backend management).
- **Key Functions**: `active_backend_id()` returns the current engine, `get_active_tts_backend()` returns the instance, and `reset_active_backend()` clears the cache when switching.
- **Switching Methods**: Set `OMNIVOICE_TTS_BACKEND` to `"voxcpm2"`, `"indextts"`, or other registered IDs, or use the Settings UI dropdown.
- **Resource Management**: The system automatically unloads previous backends and frees VRAM when you switch engines.

## Frequently Asked Questions

### What is the default TTS engine ID in VoiceStudio?

The default TTS engine ID is `"omnivoice"`, which corresponds to the `OmniVoiceBackend` class. This is defined in [`backend/services/tts_backend.py`](https://github.com/debpalash/VoiceStudio/blob/main/backend/services/tts_backend.py) where the `OMNIVOICE_TTS_BACKEND` environment variable falls back to `"omnivoice"` when not explicitly set.

### How do I switch to VoxCPM2 or IndexTTS?

Set the `OMNIVOICE_TTS_BACKEND` environment variable to `"voxcpm2"` for the VoxCPM2 engine or `"indextts"` for the IndexTTS engine, then restart VoiceStudio. Alternatively, select these engines from the **Settings → Engine → TTS Engine** dropdown in the UI.

### Do I need to restart VoiceStudio after changing the engine?

If you change the engine via the environment variable, you must restart the application for `active_backend_id()` to read the new value. If you use the Settings UI, the application typically handles the transition automatically by calling `reset_active_backend()` and reloading the backend without requiring a full restart.

### Where is the active TTS backend cached in the code?

The active backend instance is cached in the [`tts_backend.py`](https://github.com/debpalash/VoiceStudio/blob/main/tts_backend.py) module (around lines 2696–2700). The `get_active_tts_backend()` function checks this cache, and `reset_active_backend()` clears it, forcing the creation of a new instance with the updated configuration.