KaniTTS<T>

Models & Types · AiDotNet.TextToSpeech.Latest

KaniTTS (nineninesix.ai, 2025): text-to-speech as language modeling — an LFM2 language model reads the text and writes NVIDIA NanoCodec codes, four per frame at 12.5 frames a second, which NanoCodec’s causal decoder turns into 22.05 kHz audio.

Inheritance: NeuralNetworkBase<T> → TtsModelBase<T> → KaniTTSBase<T> → KaniTTS<T>

For Beginners

KaniTTS treats speech as text a small language model can write: after the sentence it writes a stream of sound codes, and a codec turns those codes into audio. Multi-speaker checkpoints take a speaker’s name.

How It Works

KaniTTS has no paper; its release is the reference: the prompt (start-of-human, the text, end-of-text, end-of-human), sampling and the speech extraction of the kani-tts 0.0.4 package, the streaming extraction of the basic example, and the fine-tuning pipeline’s data format and recipe (KaniTTS-Finetune-pipeline). The language model is transformers’ Lfm2ForCausalLM and the codec NeMo’s AudioCodecModel, both ported.

Example

var architecture = new NeuralNetworkArchitecture<float>(InputType.OneDimensional, NeuralNetworkTaskType.Regression, inputSize: 1, outputSize: 1);
var model = new KaniTTS<float>(architecture, new KaniTTSOptions());
model.LoadReferenceWeights("kani-tts-370m");                                   // model.safetensors, tokenizer.json, config.json
model.LoadCodecWeights("nemo-nano-codec-22khz-0.6kbps-12.5fps.nemo");
model.Speaker = "andrew";
var audio = model.Synthesize("Hello, how are you doing today?");

Constructors

Constructor Summary
KaniTTS(NeuralNetworkArchitecture<T> architecture) Calls the fully specified overload with the omitted parameters’ defaults.
KaniTTS(NeuralNetworkArchitecture<T> architecture, KaniTTSOptions options) Creates a native, trainable KaniTTS.
KaniTTS(NeuralNetworkArchitecture<T> architecture, string modelPath, KaniTTSOptions options) Creates an ONNX-backed KaniTTS for inference.