This Node.js application converts text from a file into speech using the OpenAI API's Text-to-Speech (TTS) functionality. It allows you to specify the voice and model type for the generated speech.
- Node.js installed on your system.
- An OpenAI API key. You can obtain one from the OpenAI website.
- Clone this repository to your local machine.
- Navigate to the project directory.
- Install dependencies by running:
-
Run the application by executing:
-
Follow the prompts:
- Enter your OpenAI API key.
- Provide the path to the text file you want to convert.
- Select the voice you want to use.
- Choose the model type.
- After providing the necessary inputs, the application will generate speech from the text file and save it as an audio file in the
Downloads/ai-audios
directory.
- You can change the default directory for saving audio files by modifying the
downloadsDir
variable in theinit()
function ofindex.ts
. - Adjustments to the maximum character limit for each chunk of text can be made by changing the
chunkSize
variable in theinit()
function ofindex.ts
.
This project is licensed under the MIT License. See the LICENSE file for details.
- This application uses the OpenAI API for text-to-speech conversion. Visit the OpenAI website for more information on their services.