Skip to content

A simple script that uses the OpenAI Text-to-Speech API to generate and download sample audio files with the built-in voices. Useful for testing different voices locally, prototyping AI voice apps, or creating quick audio demos.

Notifications You must be signed in to change notification settings

louieseno/open-ai-fm-script

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

OpenAI TTS Voice Sampler

A simple script that uses the OpenAI Text-to-Speech API
to generate and download sample audio files with the built-in voices.

🎧 Useful for: - Testing different voices locally\

  • Prototyping AI voice apps\
  • Creating quick audio demos

πŸ“¦ Prerequisites

  1. Install tsx globally:

    npm install -g tsx
  2. Install other project dependencies:

    npm install
  3. Get your OpenAI API key from:
    πŸ‘‰ https://platform.openai.com/api-keys


πŸš€ Usage

Run the script with your API key:

tsx src/main --apiKey=<OPEN_API_KEY>

The script will: - Call the OpenAI TTS API\

  • Model used gpt-4o-mini-tts
  • Generate .mp3 files for each built-in voice\
  • Save them to your local machine

πŸ—‚ Output

You'll find the generated audio files inside the assets/voices folder, named after each voice (e.g., alloy.mp3, echo.mp3, fable.mp3).


πŸ“ Notes

  • Make sure your API key has access to the TTS models.\
  • By default, the sample text is included for each built-in voice, but you can customize this in the voices config.

About

A simple script that uses the OpenAI Text-to-Speech API to generate and download sample audio files with the built-in voices. Useful for testing different voices locally, prototyping AI voice apps, or creating quick audio demos.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published