A lightweight server for vpeak, providing TTS capabilities via RESTful API.
Prerequisites
Local VOICEPEAK Installation:
Ensure that VOICEPEAK are installed locally on your machine. Refer to their official documentation for installation steps.
Installation & Usage
go install github.com/shinshin86/vpeakserver@latest
After installation, run the server:
vpeakserver
Note:
By default, the server starts on port 20202.
By default, CORS policy mode is set to localapps, which automatically allows requests from localhost and app:// origins.
You can specify additional allowed CORS origins using the -allowed-origin flag. For example:
# Allow access from example.com
vpeakserver -allowed-origin="https://example.com"
You can also set the CORS policy mode using the -cors-policy-mode flag:
# Set CORS policy mode to 'all'
vpeakserver -cors-policy-mode="all"
Endpoint
This repository provides a simple HTTP server for handling audio synthesis requests. It exposes two main endpoints:
/audio_query: Accepts a POST request with query parameters to return a JSON-encoded AudioQuery.
/synthesis: Accepts a POST request with a JSON body that generates and returns an audio file (.wav) synthesized using the specified text and speaker.
/setting: Provides a web interface for configuring CORS settings.
Features
Audio Query Endpoint:
Sends a POST request to /audio_query with text and speaker as required query parameters. Optional emotion, speed, and pitch parameters let you mirror the synthesis request and validate them before submission.
Audio Synthesis Endpoint:
Sends a POST request to /synthesis with a JSON payload including text, speaker, and optional emotion, speed, pitch. If successful, the server responds with a .wav audio file generated by vpeak.
Voice Parameter Control:
emotion: Supports happy, fun, angry, sad. Any other value will be ignored.
speed: Integer in the range 50–200.
pitch: Integer in the range -300–300.
CORS Support:
Configurable via the -allowed-origin flag, allowing cross-origin requests from a specified domain (default: http://localhost:3000) or from any origin by setting -allowed-origin=*.
Settings Web Interface:
Access http://localhost:20202/setting to configure CORS policies through a user-friendly web interface. The settings page allows you to:
Choose between different CORS policy modes:
localapps: Restricts CORS to app:// and localhost origins, plus any additional origins specified
all: Allows all origins (equivalent to setting -allowed-origin="*")
Add specific allowed origins (space-separated for multiple origins)
Changes to these settings take effect immediately but require a server restart for complete application.