Support extra languages in multi-lang kokoro tts (#2303)
This commit is contained in:
@@ -18,6 +18,7 @@ namespace SherpaOnnx
|
||||
|
||||
DictDir = "";
|
||||
Lexicon = "";
|
||||
Lang = "";
|
||||
}
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
public string Model;
|
||||
@@ -38,5 +39,8 @@ namespace SherpaOnnx
|
||||
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
public string Lexicon;
|
||||
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
public string Lang;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -857,6 +857,7 @@ type OfflineTtsKokoroModelConfig struct {
|
||||
DataDir string // Path to espeak-ng-data directory
|
||||
DictDir string // Path to dict directory
|
||||
Lexicon string // Path to lexicon files
|
||||
Lang string // Example: es for Spanish, fr-fr for French. Can be empty
|
||||
LengthScale float32 // Please use 1.0 in general. Smaller -> Faster speech speed. Larger -> Slower speech speed
|
||||
}
|
||||
|
||||
@@ -1006,6 +1007,9 @@ func NewOfflineTts(config *OfflineTtsConfig) *OfflineTts {
|
||||
c.model.kokoro.lexicon = C.CString(config.Model.Kokoro.Lexicon)
|
||||
defer C.free(unsafe.Pointer(c.model.kokoro.lexicon))
|
||||
|
||||
c.model.kokoro.lang = C.CString(config.Model.Kokoro.Lang)
|
||||
defer C.free(unsafe.Pointer(c.model.kokoro.lang))
|
||||
|
||||
c.model.kokoro.length_scale = C.float(config.Model.Kokoro.LengthScale)
|
||||
|
||||
c.model.num_threads = C.int(config.Model.NumThreads)
|
||||
|
||||
Reference in New Issue
Block a user