@@ -60,22 +60,45 @@ class OfflineTtsMatchaModelConfig {
60
60
final String dictDir;
61
61
}
62
62
63
+ class OfflineTtsKokoroModelConfig {
64
+ const OfflineTtsKokoroModelConfig ({
65
+ this .model = '' ,
66
+ this .voices = '' ,
67
+ this .tokens = '' ,
68
+ this .dataDir = '' ,
69
+ this .lengthScale = 1.0 ,
70
+ });
71
+
72
+ @override
73
+ String toString () {
74
+ return 'OfflineTtsKokoroModelConfig(model: $model , voices: $voices , tokens: $tokens , dataDir: $dataDir , lengthScale: $lengthScale )' ;
75
+ }
76
+
77
+ final String model;
78
+ final String voices;
79
+ final String tokens;
80
+ final String dataDir;
81
+ final double lengthScale;
82
+ }
83
+
63
84
class OfflineTtsModelConfig {
64
85
const OfflineTtsModelConfig ({
65
86
this .vits = const OfflineTtsVitsModelConfig (),
66
87
this .matcha = const OfflineTtsMatchaModelConfig (),
88
+ this .kokoro = const OfflineTtsKokoroModelConfig (),
67
89
this .numThreads = 1 ,
68
90
this .debug = true ,
69
91
this .provider = 'cpu' ,
70
92
});
71
93
72
94
@override
73
95
String toString () {
74
- return 'OfflineTtsModelConfig(vits: $vits , matcha: $matcha , numThreads: $numThreads , debug: $debug , provider: $provider )' ;
96
+ return 'OfflineTtsModelConfig(vits: $vits , matcha: $matcha , kokoro: $ kokoro , numThreads: $numThreads , debug: $debug , provider: $provider )' ;
75
97
}
76
98
77
99
final OfflineTtsVitsModelConfig vits;
78
100
final OfflineTtsMatchaModelConfig matcha;
101
+ final OfflineTtsKokoroModelConfig kokoro;
79
102
final int numThreads;
80
103
final bool debug;
81
104
final String provider;
@@ -138,6 +161,12 @@ class OfflineTts {
138
161
c.ref.model.matcha.lengthScale = config.model.matcha.lengthScale;
139
162
c.ref.model.matcha.dictDir = config.model.matcha.dictDir.toNativeUtf8 ();
140
163
164
+ c.ref.model.kokoro.model = config.model.kokoro.model.toNativeUtf8 ();
165
+ c.ref.model.kokoro.voices = config.model.kokoro.voices.toNativeUtf8 ();
166
+ c.ref.model.kokoro.tokens = config.model.kokoro.tokens.toNativeUtf8 ();
167
+ c.ref.model.kokoro.dataDir = config.model.kokoro.dataDir.toNativeUtf8 ();
168
+ c.ref.model.kokoro.lengthScale = config.model.kokoro.lengthScale;
169
+
141
170
c.ref.model.numThreads = config.model.numThreads;
142
171
c.ref.model.debug = config.model.debug ? 1 : 0 ;
143
172
c.ref.model.provider = config.model.provider.toNativeUtf8 ();
@@ -151,12 +180,19 @@ class OfflineTts {
151
180
calloc.free (c.ref.ruleFars);
152
181
calloc.free (c.ref.ruleFsts);
153
182
calloc.free (c.ref.model.provider);
183
+
184
+ calloc.free (c.ref.model.kokoro.dataDir);
185
+ calloc.free (c.ref.model.kokoro.tokens);
186
+ calloc.free (c.ref.model.kokoro.voices);
187
+ calloc.free (c.ref.model.kokoro.model);
188
+
154
189
calloc.free (c.ref.model.matcha.dictDir);
155
190
calloc.free (c.ref.model.matcha.dataDir);
156
191
calloc.free (c.ref.model.matcha.tokens);
157
192
calloc.free (c.ref.model.matcha.lexicon);
158
193
calloc.free (c.ref.model.matcha.vocoder);
159
194
calloc.free (c.ref.model.matcha.acousticModel);
195
+
160
196
calloc.free (c.ref.model.vits.dictDir);
161
197
calloc.free (c.ref.model.vits.dataDir);
162
198
calloc.free (c.ref.model.vits.tokens);
0 commit comments