AI Card Bao EXPLORER.AICARDBAO.COM
Home / open source / Kokoro
AI TOOL / #12975

Kokoro

A lightweight TTS system with only 82MB of parameters – can be run on CPUs without the need for GPUs, making it ideal for generating large amounts of English subtitles.

Introduction

An inference library for Kokoro-82M. You can pip install kokoro.

Kokoro is an open-weight TTS model with 82 million parameters. Despite its lightweight architecture, it delivers comparable quality to larger models while being significantly faster and more cost-efficient. With Apache-licensed weights, Kokoro can be deployed anywhere from production environments to personal projects.

Usage

You can run this basic cell on Google Colab. Listen to samples.

!pip install -q kokoro>=0.9.4 soundfile
!apt-get -qq -y install espeak-ng > /dev/null 2>&1
from kokoro import KPipeline
from IPython.display import display, Audio
import soundfile as sf
import torch
pipeline = KPipeline(lang_code='a')
text = '''
[Kokoro](/kˈOkəɹO/) is an open-weight TTS model with 82 million parameters. Despite its lightweight architecture, it delivers comparable quality to larger models while being significantly faster and more cost-efficient. With Apache-licensed weights, [Kokoro](/kˈOkəɹO/) can be deployed anywhere from production environments to personal projects.
'''
generator = pipeline(text, voice='af_heart')
for i, (gs, ps, audio) in enumerate(generator):
    print(i, gs, ps)
    display(Audio(data=audio, rate=24000, autoplay=i==0))
    sf.write(f'{i}.wav', audio, 24000)

Under the hood, kokoro uses misaki, a G2P library at https://github.com/hexgrad/misaki

Advanced Usage

You can run this advanced cell on Google Colab.

# 1️⃣ Install kokoro
!pip install -q kokoro>=0.9.4 soundfile
# 2️⃣ Install espeak, used for English OOD fallback and some non-English languages
!apt-get -qq -y install espeak-ng > /dev/null 2>&1

# 3️⃣ Initalize a pipeline
from kokoro import KPipeline
from IPython.display import display, Audio
import soundfile as sf
import torch
# 🇺🇸 'a' => American English, 🇬🇧 'b' => British English
# 🇪🇸 'e' => Spanish es
# 🇫🇷 'f' => French fr-fr
# 🇮🇳 'h' => Hindi hi
# 🇮🇹 'i' => Italian it
# 🇯🇵 'j' => Japanese: pip install misaki[ja]
# 🇧🇷 'p' => Brazilian Portuguese pt-br
# 🇨🇳 'z' => Mandarin Chinese: pip install misaki[zh]
pipeline = KPipeline(lang_code='a') #  graphemes/text
    print(ps) # ps => phonemes
    display(Audio(data=audio, rate=24000, autoplay=i==0))
    sf.write(f'{i}.wav', audio, 24000) # save each audio file

Windows Installation

To install espeak-ng on Windows:

  1. Go to espeak-ng releases
  2. Click on Latest release
  3. Download the appropriate *.msi file (e.g. espeak-ng-20191129-b702b03-x64.msi)
  4. Run the downloaded installer

For advanced configuration and usage on Windows, see the official espeak-ng Windows guide

MacOS Apple Silicon GPU Acceleration

On Mac M1/M2/M3/M4 devices, you can explicitly specify the environment variable PYTORCH_ENABLE_MPS_FALLBACK=1 to enable GPU acceleration.

PYTORCH_ENABLE_MPS_FALLBACK=1 python run-your-kokoro-script.py

Conda Environment

Use the following conda environment.yml if you're facing any dependency issues.

name: kokoro
channels:
  - defaults
dependencies:
  - python==3.9
  - libstdcxx~=12.4.0 # Needed to load espeak correctly. Try removing this if you're facing issues with Espeak fallback.
  - pip:
      - kokoro>=0.3.1
      - soundfile
      - misaki[en]

Acknowledgements

Visits:31 Updated:2026-12-04 AI tools

Related

An anime haven exclusive for lazy people Lanerc is an anime sanctuary designed specifically for those who prefer to relax and enjoy their favorite shows without any hassle. No need for tedious searches—just open it and start watching. With rapid updates and a wide range of resources, it perfectly suits your laid-back lifestyle. Here, with just a few taps of your finger, you can immerse yourself in the world of anime and find all the best shows and movies at your fingertips. Even the laziest among us can enjoy watching their favorite anime series with Lanerc. Internet Data Information Network The Chinese Internet Data Research Information Center is an organization dedicated to the study of internet data, internet-related research surveys, IT data analysis, as well as the collection and analysis of data from authoritative internet institutions. Its mission is to provide a platform for data sharing among professionals and decision-makers in the fields of internet research and consulting, as well as within the IT industry. This is where you can find all relevant information. Little Sharing Station Xiaoxiao Sharing Station is a professional website dedicated to sharing resources from the Quark cloud storage service. It offers you the free opportunity to share various types of content, including movies, TV shows, games, and software. bouncing frog An immense amount of resources can be found with just one search. Discover the latest, practical, and free treasures available across the internet – including course tutorials, software tools, single-player games, and creative materials of all kinds. Floating Light Navigation A clean and aesthetically pleasing browser homepage that integrates popular bookmarks, multiple search engines, dynamic wallpapers, and useful utilities. application set Explore the mobile and desktop applications developed by Dkluge Studio for real-world usage scenarios – these applications cover areas such as efficiency, productivity, imaging, audio processing, search functions, and drawing tools.