Skip to content

About

A kokoro tts wrapper that allows easy access to the kokoro text to speech model for performing tasks in other python programs locally.

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

Kokoro Text-to-Speech Wrapper

Easy to use python wrapper for the Kokoro text-to-speech system.

Features

  • Easy to use and setup
  • Integrates with your existing python projects
  • Multiple voice options
  • Adjustable speech speed

Installation

Install the required package:

pip install kokoro-tts
pip install soundfile

Usage

from tts import TextToSpeech

# Initialize TTS (will use GPU if available)
tts = TextToSpeech()

# Generate speech
tts.generate_audio(
    text="Hello, this is a test of the text to speech system.",
    voice='heart', # Available voices: 'heart', 'michael', 'emma', 'george'
    speed=1.0, # Speed range: 0.5 to 2.0
    output_file='output.wav'
)

API Reference

TextToSpeech Class

__init__(use_gpu=None)

Initialize the TTS system.

  • use_gpu: Optional boolean to force GPU (True) or CPU (False). If None, will use GPU if available.

generate_audio(text, voice='heart', speed=1.0, output_file='output.wav')

Generate audio from text and save to file.

  • text: Text to convert to speech
  • voice: Voice ID to use (default: 'heart')
  • speed: Speech speed multiplier, range 0.5 to 2.0 (default: 1.0)
  • output_file: Output WAV file path (default: 'output.wav')
  • Returns: Boolean indicating success or failure

Voice Options

The following voices are available:

  • 'heart'
  • 'michael'
  • 'emma'
  • 'george'

Kokoro supports many more voices and languages.You can add more when necessary.

Error Handling

Please refer to the Kokoro package license for usage terms and conditions.

About

A kokoro tts wrapper that allows easy access to the kokoro text to speech model for performing tasks in other python programs locally.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages