This is a CLI tool that uses the Emotivoice API to convert text to speech with ability for emotional synthesis. It supports multiple languages, with a default setting for Mandarin Chinese, and allows users to customize the emotional tone of the speech using Chinese prompts.
- Supports multiple languages, defaulting to Mandarin Chinese.
- Customizable emotional tone using Chinese prompts.
- Processes text input directly or from a file.
- Outputs in MP3 format with customizable voice and language options.
To convert a Chinese sentence into speech with a happy tone, run
node gen.js "春节是中国最重要的佳节之一。" --language Chinese --emotion 高兴
The output is given in the output
folder, with the timestamped and
prefixed mp3 output.
- Clone the Repository
$ git clone [repository-url]
$ cd [repository-directory]
- Install Dependencies Ensure Node.js and npm are installed, then run:
$ npm install
To use the tool, execute the following command:
- Direct Text Input:
node gen.js "Your text here" [--output <output_folder>] [--voice <voice_id>] [--language <language>] [--emotion <chinese_emotion>]
- File Input:
node gen.js -f <path_to_file> [--output <output_folder>] [--voice <voice_id>] [--language <language>] [--emotion <chinese_emotion>]
Options:
-e, --emotion <chinese_emotion>
: Optional. Specify the emotional tone using a Chinese prompt. Defaults to '高兴' (happy).
- '高兴' (Gāoxìng) - Happy
- '悲伤' (Bēishāng) - Sad
- '愤怒' (Fènnù) - Angry
- '兴奋' (Xīngfèn) - Excited
- '平静' (Píngjìng) - Calm
Set REPLICATE_API_TOKEN
in your environment variables for authentication with the Emotivoice API.
Contributions are welcome. Please fork the repository, make your changes, and submit a pull request.
This project is licensed under the MIT License.