Voice class

Represents a voice in the Kokoro TTS system

Constructors

Voice({required String id, required String name, required List<Float32List> styleVectors, required String languageCode, String gender = 'neutral'})
Creates a voice instance
const

Properties

gender String
Gender of the voice ('male', 'female', or 'neutral')
final
hashCode int
The hash code for this object.
no setterinherited
id String
Unique identifier for the voice
final
languageCode String
Language code associated with this voice (e.g., 'en-us')
final
name String
Display name of the voice
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
styleVectors List<Float32List>
The voice style vectors used for model inference Each index corresponds to a different token length
final

Methods

copyWith({String? id, String? name, List<Float32List>? styleVectors, String? languageCode, String? gender}) Voice
Create a copy of this voice with updated values
getStyleVectorForTokens(int tokenLength) Float32List
Gets the appropriate style vector for the given token length This is the key method that implements dynamic style vector selection as seen in the Python kokoro-onnx implementation
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited