Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
xuning
/
sherpaonnx
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Fangjun Kuang
2025-02-07 18:17:20 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Committed by
GitHub
2025-02-07 18:17:20 +0800
Commit
239b43c2784f5cc5f8d65ff691aa3e85eacc94c7
239b43c2
1 parent
c49bbce4
Add iOS demo for Kokoro TTS 1.0 (#1812)
隐藏空白字符变更
内嵌
并排对比
正在显示
1 个修改的文件
包含
34 行增加
和
1 行删除
ios-swiftui/SherpaOnnxTts/SherpaOnnxTts/ViewModel.swift
ios-swiftui/SherpaOnnxTts/SherpaOnnxTts/ViewModel.swift
查看文件 @
239b43c
...
...
@@ -180,10 +180,43 @@ func getTtsFor_kokoro_en_v0_19() -> SherpaOnnxOfflineTtsWrapper {
return
SherpaOnnxOfflineTtsWrapper
(
config
:
&
config
)
}
func
getTtsFor_kokoro_multi_lang_v1_0
()
->
SherpaOnnxOfflineTtsWrapper
{
// please see https://k2-fsa.github.io/sherpa/onnx/tts/pretrained_models/kokoro.html
let
model
=
getResource
(
"model"
,
"onnx"
)
let
voices
=
getResource
(
"voices"
,
"bin"
)
// tokens.txt
let
tokens
=
getResource
(
"tokens"
,
"txt"
)
let
lexicon_en
=
getResource
(
"lexicon-us-en"
,
"txt"
)
let
lexicon_zh
=
getResource
(
"lexicon-zh"
,
"txt"
)
let
lexicon
=
"
\(
lexicon_en
)
,
\(
lexicon_zh
)
"
// in this case, we don't need lexicon.txt
let
dataDir
=
resourceURL
(
to
:
"espeak-ng-data"
)
let
dictDir
=
resourceURL
(
to
:
"dict"
)
let
numFst
=
getResource
(
"number-zh"
,
"fst"
)
let
dateFst
=
getResource
(
"date-zh"
,
"fst"
)
let
phoneFst
=
getResource
(
"phone-zh"
,
"fst"
)
let
ruleFsts
=
"
\(
dateFst
)
,
\(
phoneFst
)
,
\(
numFst
)
"
let
kokoro
=
sherpaOnnxOfflineTtsKokoroModelConfig
(
model
:
model
,
voices
:
voices
,
tokens
:
tokens
,
dataDir
:
dataDir
,
dictDir
:
dictDir
,
lexicon
:
lexicon
)
let
modelConfig
=
sherpaOnnxOfflineTtsModelConfig
(
kokoro
:
kokoro
)
var
config
=
sherpaOnnxOfflineTtsConfig
(
model
:
modelConfig
)
return
SherpaOnnxOfflineTtsWrapper
(
config
:
&
config
)
}
func
createOfflineTts
()
->
SherpaOnnxOfflineTtsWrapper
{
// Please enable only one of them
return
getTtsFor_kokoro_en_v0_19
()
return
getTtsFor_kokoro_multi_lang_v1_0
()
// return getTtsFor_kokoro_en_v0_19()
// return getTtsFor_matcha_icefall_zh_baker()
...
...
请
注册
或
登录
后发表评论