Skip to main content

Local and offline assets

Each model needs an ONNX file and voices.npz. The default CE phonemizer also needs en_rules and en_list.

Native local paths

final tts = await KittenTTS.create(
config: const KittenTTSConfig(
model: 'nano-int8',
modelFiles: KittenTTSModelFiles(
onnxPath: '/absolute/path/to/kitten_tts_nano_v0_8.onnx',
voicesPath: '/absolute/path/to/voices.npz',
),
),
);

Supplying modelFiles skips model download and cache resolution.

Flutter Web assets

const KittenTTSModelFiles(
onnxPath: 'assets/models/kitten_tts_nano_v0_8.onnx',
voicesPath: 'assets/models/voices.npz',
)

Web paths may also be HTTP URLs. The hosting origin must allow browser fetches.

Local phonemizer data

CEPhonemizer(
rulesPath: '/absolute/path/to/en_rules',
listPath: '/absolute/path/to/en_list',
)

rulesText and listText let an app load Flutter assets itself and seed the phonemizer cache.

Custom model host

const KittenTTSConfig(
model: 'nano-int8',
modelBaseUrl: 'https://assets.example.com/kittentts/nano-int8',
)

The directory must preserve the expected ONNX and voices.npz filenames.