/pyvcroid2-api

A RESTful API layer to use VOICEROID2 as a service.

Primary LanguagePythonMIT LicenseMIT

pyvcroid2-api

A RESTful API layer to use VOICEROID2 as a service.

FeaturesπŸ’«

  • VOICEROID RESTful APIs: Provides RESTful APIs for VOICEROID2. Uses pyvcroid2 internally; the Python wrapper for VOICEROID DLL.
  • Compressed Audio: Provides the encoding to the format that is supported by ffmpeg and pydub.
  • Cache: Returns cache if the requested params are completely same to enhance the perfomance.

SetupπŸ› 

NOTE: This library supports Windows OS only. Tested on Python 3.8.

  1. Install the dependencies:

    • VOICEROID2 (x64 version is required) πŸ‘‰ https://www.ah-soft.com/history/2020.html
    • ffmpeg: Audio converter πŸ‘‰ https://ffmpeg.org
    • pydub: Python interface for ffmpeg (... and more features!) πŸ‘‰ pip install pydub
    • FastAPI: API framework πŸ‘‰ pip install fastapi
    • Uvicorn: ASGI server πŸ‘‰ pip install uvicorn
  2. Clone this repository.

  3. Clone and put pyvcroid2 into the directory of pyvcroid2-api.

pyvcroid2-api-master
β”œβ”€β”€ pyvcroid2 πŸ‘ˆ Here!
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ aitalk.py
β”‚   └── pyvcroid2.py
β”œβ”€β”€ pyvcroid2api
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ controllers.py
:   :

TryπŸš€

Start server.

$ uvicorn run:app

Install the HTTP client library.

$ pip install requests

Call API.

$ python client.py

Make sure that hello.mp3 is created and that sounds "こんにけは" in Japanese.

Custom encoder

You can customize pyvcroid2api.encoder.DefaultEncoder directly or implement Encoder and set it in run.py instead.

class MyEncoder(Encoder):
    :

VoiceroidEngine.setup(encoder=MyEncoder)

Thanks❀️

pyvcroid2 by @NkyokuP, is an awesome library that enables us using VOICEROID2 without GUI. pyvcroid2-api is just a wrapper of this library. Thank you!