You can run this basic cell on
Google Colab.
Listen to samples. For more languages and details, see
Advanced Usage.
1!pip install -q kokoro>=0.9.2 soundfile
2!apt-get -qq -y install espeak-ng > /dev/null 2>&1
3from kokoro import KPipeline
4from IPython.display import display, Audio
5import soundfile as sf
6import torch
7pipeline = KPipeline(lang_code='a')
8text = '''
9[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.
10'''
11generator = pipeline(text, voice='af_heart')
12for i, (gs, ps, audio) in enumerate(generator):
13 print(i, gs, ps)
14 display(Audio(data=audio, rate=24000, autoplay=i==0))
15 sf.write(f'{i}.wav', audio, 24000)
The following CC BY audio was part of the dataset used to train Kokoro v1.0.