npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, πŸ‘‹, I’m Ryan HefnerΒ  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you πŸ™

Β© 2026 – Pkg Stats / Ryan Hefner

koko-tts

v0.2.1

Published

🎀 The friendly TTS CLI - Just run 'koko' for instant text-to-speech magic!

Downloads

3

Readme

🎀 Koko TTS - Kokoro Text-to-Speech CLI

A simple, powerful command-line tool for text-to-speech generation using the Kokoro TTS engine. Convert text to natural-sounding speech with 28+ professional voices.

TypeScript Node.js License

✨ Features

  • 🎯 28 Professional Voices with quality grades (American & British English)
  • πŸš€ Interactive Mode - Just run koko for a clean, guided experience
  • πŸ“ File Input - Process text files via CLI or interactive mode
  • πŸŽ›οΈ Voice Control - Choose speed, temperature, and voice
  • πŸ“¦ Zero Config - Works out of the box
  • 🌊 Streaming - Real-time generation for long texts
  • πŸ’Ύ Multiple Formats - WAV and PCM output
  • πŸ”„ Auto-Chunking - Bypass 25-second limit with automatic text splitting
  • 🧩 Audio Stitching - Chunks automatically combined into single files
  • 🧹 Auto-Cleanup - Temp files cleaned automatically

πŸš€ Quick Start

Interactive Mode (Easiest)

# Using npx (no installation needed)
npx koko-tts@latest

# Or install globally first
npm install -g koko-tts
koko

# Clean, guided interface:
# 🎀 Koko TTS
# Simple text-to-speech generation
#
# What would you like to do?
# ❯ ✨ Generate speech
#   🎭 Browse voices
#   πŸšͺ Exit

Command Line (For Scripts & Automation)

# Generate speech instantly
npx koko-tts@latest generate "Hello, this is Koko TTS!"

# With specific voice
npx koko-tts@latest generate "Welcome to Koko!" --voice af_heart

# From a text file
npx koko-tts@latest generate --file story.txt --voice bf_emma

Using Nix (Recommended for Development)

# Clone and enter development environment
git clone https://github.com/piotutic/koko-tts
cd kokoro-tts-typescript
nix develop

# Build and use
npm run build
koko generate "Hello from Nix!"

πŸ“– Usage

Basic Commands

# Simple generation (uses default voice af_sarah)
koko generate "Your text here"

# Choose a specific voice
koko generate "Hello world" --voice af_heart

# Read from file
koko generate --file input.txt --output audiobook.wav

# Adjust speaking speed and expressiveness
koko generate "Custom speech" --speed 0.8 --temperature 0.9

# Quiet mode (minimal output)
koko generate "Silent generation" --quiet

List Available Voices

# Show all voices
koko voices

# Filter by category
koko voices --category recommended
koko voices --category american
koko voices --category british

# JSON output for scripting
koko voices --json

Interactive Mode

# Launch interactive interface (default when no arguments)
koko

# Or explicitly
koko interactive

# Interactive features:
# - Choose between typing text or loading from file
# - Smart voice selection with defaults
# - File browser with validation
# - Custom filename or smart auto-naming
# - Clean, professional interface

🎭 Voice Options

Recommended Voices (Highest Quality)

| Voice ID | Description | Language | Gender | | ------------ | ---------------------- | ---------- | ------ | | af_heart | Warm, expressive ⭐ | US English | Female | | af_bella | Clear, professional ⭐ | US English | Female | | bf_emma | Elegant, refined ⭐ | UK English | Female | | am_michael | Smooth, versatile | US English | Male | | bm_george | Distinguished, clear | UK English | Male |

⭐ = Top quality voices

Voice Categories

  • American Female: af_heart, af_bella, af_sarah (default), af_nicole, af_kore
  • American Male: am_michael, am_fenrir, am_puck, am_echo, am_eric
  • British Female: bf_emma, bf_isabella, bf_alice, bf_lily
  • British Male: bm_george, bm_fable, bm_lewis, bm_daniel

βš™οΈ Options

| Option | Description | Default | Range | | --------------- | ----------------- | ------------ | -------------- | | --voice | Voice to use | af_sarah | See voice list | | --speed | Speaking speed | 1.0 | 0.5 - 2.0 | | --temperature | Expressiveness | 0.7 | 0.1 - 1.0 | | --output | Output filename | output.wav | Any path | | --file | Input text file | - | Any .txt file | | --quiet | Minimal output | false | Boolean | | --streaming | Stream long texts | false | Boolean |

πŸ“‹ Examples

Basic Text Generation

# Simple generation
koko generate "Welcome to Koko TTS!"

# Professional presentation voice
koko generate "Good morning everyone" --voice af_bella --speed 0.9

# Storytelling with British accent
koko generate "Once upon a time..." --voice bf_emma --temperature 0.8

File Processing

# Command line file processing
koko generate --file chapter1.txt --voice am_michael --output chapter1.wav

# Interactive file processing
koko
# Choose "✨ Generate speech"
# Choose "πŸ“ Load from file"
# Enter file path with validation

# Batch process with streaming (for long files)
koko generate --file novel.txt --streaming --output audiobook.wav

Interactive Mode Workflow

# Start interactive mode
koko

# 1. Main Menu
# What would you like to do?
# ❯ ✨ Generate speech
#   🎭 Browse voices
#   πŸšͺ Exit

# 2. Input Method (when generating speech)
# How would you like to provide text?
# ❯ ⌨️  Type text manually
#   πŸ“ Load from file

# 3. File Input (if file selected)
# Enter file path: story.txt
# βœ… Loaded 1,240 characters from file
# Preview: "Once upon a time in a distant galaxy..."

# 4. Voice Selection
# Use default voice (Sarah)? (Y/n)
# Select voice: Heart (Female) / Michael (Male) / etc.

# 5. Filename Customization
# Output filename: (koko_20250917T143022.wav)
# Press Enter for default or type custom name: my-presentation
# β†’ Uses: my-presentation.wav

# 6. Generation
# Generating: my-presentation.wav
# βœ… Success! Generated: my-presentation.wav

Voice Comparison

# Test the same text with different voices
koko generate "Voice test" --voice af_heart --output heart.wav
koko generate "Voice test" --voice bf_emma --output emma.wav
koko generate "Voice test" --voice am_michael --output michael.wav

Filename Examples

# Interactive mode filename options:
# Press Enter β†’ koko_20250917T143022.wav (auto-timestamp)
# Type "presentation" β†’ presentation.wav (auto .wav)
# Type "chapter1.wav" β†’ chapter1.wav (keeps extension)
# Type "audio-notes" β†’ audio-notes.wav (auto .wav)

# Command line (unchanged)
koko generate "text" --output my-custom-name.wav

πŸ”§ Advanced Usage

Configuration

# Initialize configuration file
koko config --init

# Use custom configuration
koko generate "Text" --config my-settings.yml

# Save current settings as preset
koko generate "Test" --voice af_heart --save-config my-preset.yml

Audio Stitching & Chunks

# Default: Chunks are automatically stitched into single file
koko generate --file long-text.txt
# β†’ Creates: combined-audio.wav

# Keep individual chunks AND combined file
koko generate --file long-text.txt --keep-chunks
# β†’ Creates: combined-audio.wav + individual chunk files

# Disable stitching (legacy behavior)
koko generate --file long-text.txt --no-stitch
# β†’ Creates: audio_001.wav, audio_002.wav, audio_003.wav...

Cleanup

# Clean temp files older than 24 hours (default)
koko cleanup

# Custom cleanup age
koko cleanup --max-age 48

# Verbose cleanup output
koko cleanup --verbose

Performance & Quality

# High quality (slower)
koko generate "Text" --dtype fp32

# Balanced quality/speed (default)
koko generate "Text" --dtype q8

# Fast generation (lower quality)
koko generate "Text" --dtype q4

πŸƒ Performance Tips

  1. First Run: Downloads the model (~100MB), subsequent runs are much faster
  2. Voice Selection: af_heart and af_bella provide the best quality
  3. Speed Settings: 0.8-0.9 for presentations, 1.0-1.2 for casual content
  4. Long Texts: Use --streaming for files over 500 characters
  5. File Format: WAV provides best compatibility

πŸ“ Organized Directory Structure

Koko TTS automatically organizes all files in a .koko-tts/ directory:

.koko-tts/
β”œβ”€β”€ config/              # Configuration files
β”œβ”€β”€ cache/               # Audio cache for faster re-generation
β”œβ”€β”€ outputs/             # Generated audio files
β”‚   β”œβ”€β”€ YYYY-MM-DD/      # CLI outputs by date
β”‚   └── interactive/     # Interactive mode outputs
β”‚       └── YYYY-MM-DD/
└── temp/                # Temporary files (auto-cleaned)

Benefits:

  • Clean workspace (no scattered output files)
  • Easy cleanup (delete entire .koko-tts/ folder)
  • Organized by date and generation mode
  • Add to .gitignore: echo ".koko-tts/" >> .gitignore

πŸ› Troubleshooting

Common Issues

Model Download Fails

# Check internet connection and retry
koko generate "test" --verbose

Audio File Issues

# Verify output file was created
ls -la output.wav

# Test audio playback (Linux)
ffplay output.wav
# or
aplay output.wav

Permission Denied

# Ensure CLI has execute permissions
npm run build  # This sets permissions automatically

πŸ“¦ Development

Project Structure

src/
β”œβ”€β”€ cli.ts           # Main CLI application
β”œβ”€β”€ tts-engine.ts    # TTS engine wrapper
β”œβ”€β”€ voices.ts        # Voice configurations
β”œβ”€β”€ types.ts         # TypeScript definitions
└── utils.ts         # Utility functions

Build Commands

# Build TypeScript
npm run build

# Type checking
npm run type-check

# Clean build files
npm run clean

# Development mode
npm run cli -- generate "dev test"

Adding New Voices

Edit src/voices.ts to add new voice configurations with metadata.

πŸ“„ License

Apache License 2.0 - see LICENSE file for details.

πŸ™ Acknowledgments

πŸ”— Links


Simple, powerful text-to-speech: Just run koko for interactive mode or koko generate "your text" for command line 🎀