Skip to content

A TTS that fits in your CPU (and pocket)

Python
5.2 KB
Raw Blame

Generate

The generate command allows you to generate speech from text directly from the command line using Kyutai Pocket TTS.

Basic Usage

uvx pocket-tts generate
# or if installed manually:
pocket-tts generate

This will generate a WAV file ./tts_output.wav with the default text and voice.

Command Options

Core Options

  • --text TEXT: Text to generate (default: "Hello world! I am Kyutai Pocket TTS. I'm fast enough to run on small CPUs. I hope you'll like me.")
  • --voice VOICE: Path to audio conditioning file (voice to clone). Defaults to a built-in voice chosen from the language: giovanni (it) for italian, lola (es) for spanish, juergen (de) for german, rafael (pt) for portuguese, estelle (fr) for french, alba (en) otherwise. With --config or --checkpoint, defaults to alba's audio file instead of the voice name, since the pre-made voices only exist for the released language models. Urls and local paths are supported.
  • --output-path OUTPUT_PATH: Output path for generated audio (default: "./tts_output.wav")
  • --language LANGUAGE: Language for the TTS model, one of 'english_2026-01', 'english_2026-04', 'english_2026-09', 'english_2026-09_2', 'english_2026-10', 'english_drifting_26-09', 'english_18m_2026-10', 'english_18m_refl_2026-10', 'english_7m_2026-10', 'english_7m_refl_2026-10', 'english_2m_2026-10', 'english_2m_refl_2026-10', 'english', 'french', 'french_24l', 'german', 'german_24l', 'portuguese', 'portuguese_24l', 'italian', 'italian_24l', 'spanish', 'spanish_24l', 'dutch', 'dutch_24l' (default: english, which is the same model as 'english_2026-10'). Incompatible with --config. The "24l" variants are bigger models, not distilled yet and here only as preview.

Generation Parameters

  • --config CONFIG_PATH: Path to a custom config.yaml — a local path, an https:// URL, or an hf:// path. Incompatible with --language.
  • --sampler-decode-steps SAMPLER_DECODE_STEPS: Number of generation steps (default: 1)
  • --temperature TEMPERATURE: Temperature for generation (default: 0.3)
  • --noise-clamp NOISE_CLAMP: Noise clamp value (default: None)
  • --eos-threshold EOS_THRESHOLD: EOS threshold (default: -4.0)
  • --frames-after-eos FRAMES_AFTER_EOS: Number of frames to generate after EOS (default: None, auto-calculated based on the text length). Each frame is 80ms.
  • --max-tokens MAX_TOKENS: Long texts are generated in chunks of at most this many tokens (default: 50, or 25 with --teacher-force-previous-chunk)
  • --teacher-force-previous-chunk: Generate each chunk of a long text as the continuation of the previous one (the previous chunk's audio latents are teacher-forced, with the text of both chunks) instead of starting afresh from the voice prompt (default: False). Slightly slower.

Performance Options

  • --device DEVICE: Device to use (default: "cpu"). Whether GPU helps is hardware-dependent — see the main README's "Running on GPU" section for measured numbers (no speedup observed on some CPUs with strong single-thread performance like Apple Silicon, but a measured ~2.6x speedup on a cloud x86 VM with a Tesla T4).
  • --quantize: Use int8 quantization for the model (default: False). This can reduce memory usage and increase speed, with minimal impact on audio quality.
  • --quiet, -q: Disable logging output

Examples

Basic Generation

# Generate with default settings
pocket-tts generate

# Custom text
pocket-tts generate --text "Hello, this is a custom message."

# Custom output path
pocket-tts generate --output-path "./my_audio.wav"

Voice Selection

# Use different voice from HuggingFace
pocket-tts generate --voice "hf://kyutai/tts-voices/jessica-jian/casual.wav"

# Use local voice file
pocket-tts generate --voice "./my_voice.wav"

# Use a safetensors file (such as one created using `pocket-tts export-voice`)
pocket-tts generate --voice "./my_voice.safetensors"

Quality Tuning

# Higher quality (more steps)
pocket-tts generate --sampler-decode-steps 5 --temperature 0.5

# More expressive (higher temperature)
pocket-tts generate --temperature 1.0

# Adjust EOS threshold, smaller means finishing earlier.
pocket-tts generate --eos-threshold -3.0

Custom Model Config

If you'd like to override the paths from which the models are loaded, you can provide a custom YAML configuration.

Copy one of the files in pocket_tts/config (for example pocket_tts/config/english.yaml) and change weights_path, weights_path_without_voice_cloning, and tokenizer_path to the paths of the models you want to load.

Then, use the --config option to point to your newly created config.

# Use a different config
pocket-tts generate --config "C://pocket-tts/my_config.yaml"

Output Format

The generate command always outputs WAV files in the following format:

  • Sample Rate: 24kHz
  • Channels: Mono
  • Bit Depth: 16-bit PCM
  • Format: Standard WAV file

For more advanced usage, see the Python API documentation or consider using the serve command for web-based generation and quick iteration.