Skip to content

About

HTTP server for OmniVoice multilingual TTS

Resources

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

 

History

18 Commits

Folders and files

Repository files navigation

OmniSpeech Server

OmniSpeechServer

Hugging Face Model   Hugging Face Space  

OmniVoice is a state-of-the-art zero-shot multilingual TTS model supporting more than 600 languages. Built on a novel diffusion language model architecture, it generates high-quality speech with superior inference speed, supporting voice cloning and voice design.

  • zero-shot TTS, 600+ languages!
  • single-stage arch based on Qwen3-0.6B;
  • fast inference;
  • beats ElevenLabs v2;

OmniSpeech Server is an HTTP server for text-to-speech (TTS) generation using OmniVoice. It provides a simple and efficient REST API that allows applications, scripts, automation pipelines, and backend services to convert text into speech and receive the generated audio in WAV format.

The server is designed to make speech synthesis easier to deploy, easier to consume, and easier to integrate into real-world environments. Instead of embedding model loading and inference logic into each individual application, OmniSpeech Server centralizes the TTS process in a single service. The model is loaded once at startup and remains available in memory, allowing clients to send requests and receive speech output through a clean HTTP interface.

This approach makes the project especially useful for developers and teams who want a reusable voice generation service that can be shared across multiple systems.


Author

Alessandro de Oliveira Faria (A.K.A. CABELO)

License

This project is licensed under the MIT License.

Features

  • HTTP REST API for text-to-speech generation
  • OmniVoice-based speech synthesis
  • Model loaded only once during server startup
  • Direct audio/wav response
  • Optional WAV saving on the server filesystem
  • CUDA support for GPU acceleration
  • Health check endpoint for monitoring
  • Easy integration with curl, Python, and automation scripts
  • Clean architecture for backend and service-based deployments
  • Simple and practical interface for local or remote usage

Why OmniSpeech Server

OmniSpeech Server was built to turn speech generation into a reusable service. In many real-world scenarios, developers do not want to place model initialization and inference logic inside every script or application. Instead, they need a stable server that receives text, synthesizes speech, and returns audio through a predictable API.

By exposing OmniVoice through HTTP, OmniSpeech Server offers several practical advantages:

  • simpler deployment
  • centralized inference
  • reduced code duplication
  • easier automation
  • language-agnostic integration
  • straightforward testing with HTTP tools
  • easier operation in development and production environments

This makes it suitable for both experimentation and operational use.


Use Cases

OmniSpeech Server can be used in many scenarios, including:

  • AI assistants with spoken responses
  • chatbots with audio output
  • accessibility tools
  • automation scripts
  • notification systems
  • backend voice services
  • educational tools
  • monitoring systems with spoken alerts
  • home automation
  • IVR and speech-enabled prototypes
  • local AI voice infrastructure

How It Works

At a high level, OmniSpeech Server follows a simple workflow:

  1. the server starts
  2. the OmniVoice model is loaded into memory
  3. a client sends a POST request with text and optional generation parameters
  4. the server generates speech
  5. the waveform is converted to WAV
  6. the audio is returned to the client or saved on disk

This design keeps the service efficient, reusable, and easy to integrate.


Requirements

  • Python 3.10+
  • PyTorch
  • torchaudio
  • Flask
  • NumPy
  • OmniVoice
  • NVIDIA GPU with CUDA support recommended for best performance

Installation

Create a environment

git clone https://github.com/cabelo/OmniSpeechServer
cd OmniSpeechServer
python3 -m venv .venv
source .venv/bin/activate
pip install torch==2.8.0+cu128 torchaudio==2.8.0+cu128 --extra-index-url https://download.pytorch.org/whl/cu128
pip install flask numpy omnivoice
export HF_TOKEN=[your-token]

Running the Server

Start the server with:

python3 omnivoice_http_server.py --device cuda:0

Or specify host and port explicitly:

python3 omnivoice_http_server.py --host 0.0.0.0 --port 5000 --device cuda:0

API Endpoints

GET /health

Simple health check endpoint.

Example

curl http://localhost:5000/health

Response

{"status":"ok"}

POST /tts

Generate speech from text.

Request JSON

Field Type Required Description
text string yes Text to convert into speech
instruct string no Speaker or style instruction
language string no Language code such as pt
save_path string no Save WAV file on the server filesystem

curl Examples

1. Generate speech and play directly

curl -s -X POST \
  -H 'Content-Type: application/json' \
  -d '{"text":"Boa noite Gabriel! Aqui é Topzeira!","instruct":"male, low pitch, american accent","language":"pt"}' \
  http://localhost:5000/tts | aplay

2. Generate speech and save locally

curl -s -X POST \
  -H 'Content-Type: application/json' \
  -d '{"text":"Olá! Este áudio foi gerado pelo OmniSpeech Server.","instruct":"male, low pitch, american accent","language":"pt"}' \
  http://localhost:5000/tts -o out.wav

3. Save WAV on the server disk

curl -s -X POST \
  -H 'Content-Type: application/json' \
  -d '{"text":"Este arquivo será salvo no disco do servidor.","instruct":"male, low pitch, american accent","language":"pt","save_path":"/tmp/out.wav"}' \
  http://localhost:5000/tts

Example response

{
  "status": "saved",
  "path": "/tmp/out.wav",
  "sample_rate": 24000
}

Python Example

import requests

url = "http://localhost:5000/tts"
payload = {
    "text": "Olá! Este é um teste de voz com OmniSpeech Server.",
    "instruct": "male, low pitch, american accent",
    "language": "pt"
}

response = requests.post(url, json=payload)

if response.status_code == 200:
    with open("output.wav", "wb") as f:
        f.write(response.content)
    print("Audio saved as output.wav")
else:
    print("Error:", response.status_code, response.text)

Example Request

{
  "text": "A declaração de Pedro após a sua vitória sobre o adversário deve ultrapassar o campo esportivo e deve chegar ao Superior Tribunal de Justiça Desportiva.",
  "instruct": "Male, elderly, very low pitch, portuguese accent",
  "language": "pt"
}

Example Error Response

{
  "error": "field 'text' is required"
}

About

HTTP server for OmniVoice multilingual TTS

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages