Code Monkey home page Code Monkey logo

ganyutts's Introduction

GanyuTTS

GanyuTTS is a VITS + SO-VITS tool for generating speech from text. It was originally made for the game Elite Dangerous, but I separated it from the main project, so now it can function as a standalone inference tool or API. EddiTTS is available here.

This is definitely just a toy project, so don't expect too much. There are many things still hardcoded, and the code is not very clean. I'll try to clean it up in the future.

I just made this repo for my own convenience, but feel free to use it if you want.

Installation

I suggest using a virtual environment for this (conda or venv). Also, I recommend using Python 3.9 or higher. GPU is not required, but it will speed up the inference.

pip install -r requirements.txt

For phonemizer you need to have espeak installed. On Windows, you can download it from here. On Linux, you can install it using your package manager.

Usage

Config file

The program needs a config file named config.json in the root folder. An example file is provided. You can change the paths to the models and the API keys. Phonemizer paths are only relevant for Windows users, you can edit here if you have espeak installed in a different location. If you want to use the interactive mode, you need to get an API key from OpenAI. It's super cheap and worth the quality of the responses.

Main API

To start the API, run the following command:

python main.py

This app provides a simple flask API for text-to-speech. You can send a POST request to the server, it will return the audio wav file.

Example request body:

{
    "text": "Hello, world!",
    "sid1": "22", # speaker id in the multi-speaker VITS model
    "sid2": "ganyu" # speaker id in the SO-VITS model
}

Response:

{
    "audio": "<audio wav>" # base64 encoded raw audio
}

An api_client_example.py is provided for testing the API.

Simple Inference

There are two inference scripts, one for VITS and one for the VITS + SO-VITS pipeline. You can use them to create audio simply from cli.

For VITS only:

python inference_vits.py -t "Let's get started. I'll be your guide today."

For VITS + SO-VITS:

python inference_vits_sovits.py -t "Let's get started. I'll be your guide today"

Use -h or --help for more info.

Models

All models should be in the models folder, you have to download it manually from my huggingface repo. Also, don't forget to download the hubert model, it is needed for SO-VITS. I am using "checkpoint_best_legacy_500.pt"

Credits

ganyutts's People

Contributors

legekka avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ganyutts's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.