Skip to main content

Python Quick Start

This guide shows the current setup for the wfloat Python package.

1. Install

pip install wfloat

2. Load the model

The Python package is free to use however you want. It does not require a Wfloat modelId or model credential. Load the public wfloat/wfloat-tts model directly:

import wfloat

model = wfloat.load("wfloat/wfloat-tts")

The first load downloads the model assets. After that, the package uses the cached local copy.

3. Generate speech

import wfloat

model = wfloat.load("wfloat/wfloat-tts")

result = model.generate(
text="No, no, that's not possible. The formula should have crystallized, but it adapted instead. Do you realize what that means for the rest of my work?",
voice_id="mad_scientist_woman",
emotion="surprise",
intensity=0.7,
)

result.audio.save("out.wav")

4. Generate dialogue

import wfloat

model = wfloat.load("wfloat/wfloat-tts")

result = model.generate_dialogue(
segments=[
{
"voice_id": "wise_elder_man",
"text": "Rain taps against the tavern shutters as you step inside.",
"emotion": "neutral",
"intensity": 0.5,
},
{
"voice_id": "strong_hero_man",
"text": "You're late. Two bandits stole the king's map over three hours ago.",
"emotion": "fear",
"intensity": 0.6,
},
{
"voice_id": "strong_hero_man",
"text": "They fled north, up into the woods.",
"emotion": "neutral",
"intensity": 0.5,
},
],
silence_between_segments_sec=0.35,
)

result.audio.save("dialogue.wav")

5. Use the CLI

You can also generate a WAV from the command line:

wfloat generate \
--text "Hello world!" \
--out out.wav \
--voice-id mad_scientist_woman \
--emotion surprise \
--intensity 0.7 \
--silence-padding-sec 0

For full CLI help:

wfloat generate --help

6. Voice IDs

Use voice_id string names or numeric sid values:

SpeakerSID
skilled_hero_man0
skilled_hero_woman1
fun_hero_man2
fun_hero_woman3
strong_hero_man4
strong_hero_woman5
mad_scientist_man6
mad_scientist_woman7
clever_villain_man8
clever_villain_woman9
narrator_man10
narrator_woman11
wise_elder_man12
wise_elder_woman13
outgoing_anime_man14
outgoing_anime_woman15
scary_villain_man16
scary_villain_woman17
news_reporter_man18
news_reporter_woman19

7. Emotions

Supported emotion labels:

  • neutral
  • joy
  • sadness
  • anger
  • fear
  • surprise
  • dismissive
  • confusion

intensity must be between 0.0 and 1.0.