mstar.model.kokoro.components#
- class mstar.model.kokoro.components.KokoroTTS(config)[source]#
Bases:
Module- Parameters:
config (KokoroModelConfig)
- align(d, t_en, pred_dur, num_frames)[source]#
Expand phoneme features to
num_framesframes.Returns the frame-aligned prosody states
[B, F, hidden + style], the aligned text features[B, hidden, F]and each row’s valid frame count.
- static alignment(pred_dur, num_frames)[source]#
Index of the phoneme that owns each frame,
[B, num_frames].Equal to the reference’s
repeat_interleave+ one-hot matmul on the valid frames; frames past a row’s total point at its last phoneme.
- decode_frames(en, asr, frame_lengths, style)[source]#
Frame-aligned features -> waveform
[B, F * samples_per_frame].
- encode_text(input_ids, lengths, style, speed)[source]#
[B, T]ids -> prosody states[B, T, hidden + style], text features[B, hidden, T]and integer durations[B, T].
Modules
Style-conditioned normalization blocks shared by the prosody predictor and the decoder (StyleTTS2's |
|
PL-BERT: the ALBERT phoneme encoder that conditions Kokoro's prosody. |
|
iSTFTNet decoder: prosody-conditioned convolutional trunk, harmonic-plus-noise excitation, two upsampling stages with Snake residual blocks, and an inverse STFT head (StyleTTS2's |
|
Bidirectional LSTM over padded batches without packing. |
|
Length masks for padded batches. |
|
Text encoder and prosody predictor (durations, F0 and energy) of Kokoro. |
|
Short-time Fourier analysis and synthesis over padded batches. |
|
The whole Kokoro network: phonemes + style -> waveform, batched and masked. |