KittenTtsEngine class final
End-to-end KittenTTS engine: text → audio float array.
Wires together G2P, front runner, source/STFT, decoder, and iSTFT into a single synthesise call. All components use Dart-native MLX operations (no Python-exported functions).
Usage:
final engine = KittenTtsEngine.load(
snapshotPath: '/path/to/model',
espeakLibPath: '/path/to/libespeak-ng.dylib',
espeakDataPath: '/path/to/espeak-ng-data',
);
final result = engine.synthesise('Hello world');
// result.audio: MlxArray [1, numSamples]
// result.sampleRate: 24000
result.close();
engine.dispose();
Constructors
- KittenTtsEngine.load({required String snapshotPath, required String espeakLibPath, required String espeakDataPath, String voice = 'en-us'})
-
Loads all model components from a snapshot directory.
factory
Properties
- config → ModelConfig
-
final
- decoder → KittenDecoder
-
final
- front → KittenFrontRunner
-
final
- g2p → EspeakG2p
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
voiceNames
→ List<
String> -
Available voice names from the loaded voices.npz.
no setter
-
voices
→ Map<
String, NpyArray> -
final
Methods
-
dispose(
) → void - Releases all resources.
-
effectiveSpeed(
String? voiceName, {double baseSpeed = 1.0}) → double - Resolves the effective speed for a voice, applying speed_priors if set.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
synthesise(
String text, {String? voiceName, double speed = 1.0}) → KittenTtsResult -
Synthesises speech from
text. -
synthesiseWithRef(
String text, MlxArray refS, {double speed = 1.0}) → KittenTtsResult -
Synthesises using a pre-built reference style vector
[1, 256]. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited