正在显示
2 个修改的文件
包含
46 行增加
和
14 行删除
| @@ -39,8 +39,7 @@ echo "SHERPA_ONNXRUNTIME_INCLUDE_DIR $SHERPA_ONNXRUNTIME_INCLUDE_DIR" | @@ -39,8 +39,7 @@ echo "SHERPA_ONNXRUNTIME_INCLUDE_DIR $SHERPA_ONNXRUNTIME_INCLUDE_DIR" | ||
| 39 | # The symbol _NSLog is not defined | 39 | # The symbol _NSLog is not defined |
| 40 | # | 40 | # |
| 41 | 41 | ||
| 42 | -if [[ ! -f ./build/simulator_x86_64/lib/libsherpa-onnx-c-api.a ]]; then | ||
| 43 | - cmake \ | 42 | +cmake \ |
| 44 | -DBUILD_PIPER_PHONMIZE_EXE=OFF \ | 43 | -DBUILD_PIPER_PHONMIZE_EXE=OFF \ |
| 45 | -DBUILD_PIPER_PHONMIZE_TESTS=OFF \ | 44 | -DBUILD_PIPER_PHONMIZE_TESTS=OFF \ |
| 46 | -DBUILD_ESPEAK_NG_EXE=OFF \ | 45 | -DBUILD_ESPEAK_NG_EXE=OFF \ |
| @@ -63,13 +62,11 @@ if [[ ! -f ./build/simulator_x86_64/lib/libsherpa-onnx-c-api.a ]]; then | @@ -63,13 +62,11 @@ if [[ ! -f ./build/simulator_x86_64/lib/libsherpa-onnx-c-api.a ]]; then | ||
| 63 | -DDEPLOYMENT_TARGET=13.0 \ | 62 | -DDEPLOYMENT_TARGET=13.0 \ |
| 64 | -B build/simulator_x86_64 | 63 | -B build/simulator_x86_64 |
| 65 | 64 | ||
| 66 | - cmake --build build/simulator_x86_64 -j 4 --verbose | ||
| 67 | -fi | 65 | +cmake --build build/simulator_x86_64 -j 4 --verbose |
| 68 | 66 | ||
| 69 | echo "Building for simulator (arm64)" | 67 | echo "Building for simulator (arm64)" |
| 70 | 68 | ||
| 71 | -if [[ ! -f ./build/simulator_arm64/lib/libsherpa-onnx-c-api.a ]]; then | ||
| 72 | - cmake \ | 69 | +cmake \ |
| 73 | -DBUILD_PIPER_PHONMIZE_EXE=OFF \ | 70 | -DBUILD_PIPER_PHONMIZE_EXE=OFF \ |
| 74 | -DBUILD_PIPER_PHONMIZE_TESTS=OFF \ | 71 | -DBUILD_PIPER_PHONMIZE_TESTS=OFF \ |
| 75 | -DBUILD_ESPEAK_NG_EXE=OFF \ | 72 | -DBUILD_ESPEAK_NG_EXE=OFF \ |
| @@ -93,15 +90,13 @@ if [[ ! -f ./build/simulator_arm64/lib/libsherpa-onnx-c-api.a ]]; then | @@ -93,15 +90,13 @@ if [[ ! -f ./build/simulator_arm64/lib/libsherpa-onnx-c-api.a ]]; then | ||
| 93 | -DDEPLOYMENT_TARGET=13.0 \ | 90 | -DDEPLOYMENT_TARGET=13.0 \ |
| 94 | -B build/simulator_arm64 | 91 | -B build/simulator_arm64 |
| 95 | 92 | ||
| 96 | - cmake --build build/simulator_arm64 -j 4 --verbose | ||
| 97 | -fi | 93 | +cmake --build build/simulator_arm64 -j 4 --verbose |
| 98 | 94 | ||
| 99 | echo "Building for arm64" | 95 | echo "Building for arm64" |
| 100 | 96 | ||
| 101 | export SHERPA_ONNXRUNTIME_LIB_DIR=$PWD/ios-onnxruntime/onnxruntime.xcframework/ios-arm64 | 97 | export SHERPA_ONNXRUNTIME_LIB_DIR=$PWD/ios-onnxruntime/onnxruntime.xcframework/ios-arm64 |
| 102 | 98 | ||
| 103 | -if [[ ! -f ./build/os64/lib/libsherpa-onnx-c-api.a ]]; then | ||
| 104 | - cmake \ | 99 | +cmake \ |
| 105 | -DBUILD_PIPER_PHONMIZE_EXE=OFF \ | 100 | -DBUILD_PIPER_PHONMIZE_EXE=OFF \ |
| 106 | -DBUILD_PIPER_PHONMIZE_TESTS=OFF \ | 101 | -DBUILD_PIPER_PHONMIZE_TESTS=OFF \ |
| 107 | -DBUILD_ESPEAK_NG_EXE=OFF \ | 102 | -DBUILD_ESPEAK_NG_EXE=OFF \ |
| @@ -125,10 +120,9 @@ if [[ ! -f ./build/os64/lib/libsherpa-onnx-c-api.a ]]; then | @@ -125,10 +120,9 @@ if [[ ! -f ./build/os64/lib/libsherpa-onnx-c-api.a ]]; then | ||
| 125 | -DDEPLOYMENT_TARGET=13.0 \ | 120 | -DDEPLOYMENT_TARGET=13.0 \ |
| 126 | -B build/os64 | 121 | -B build/os64 |
| 127 | 122 | ||
| 128 | - cmake --build build/os64 -j 4 | ||
| 129 | - # Generate headers for sherpa-onnx.xcframework | ||
| 130 | - cmake --build build/os64 --target install | ||
| 131 | -fi | 123 | +cmake --build build/os64 -j 4 |
| 124 | +# Generate headers for sherpa-onnx.xcframework | ||
| 125 | +cmake --build build/os64 --target install | ||
| 132 | 126 | ||
| 133 | echo "Generate xcframework" | 127 | echo "Generate xcframework" |
| 134 | 128 |
| @@ -93,12 +93,50 @@ func getTtsFor_en_US_amy_low() -> SherpaOnnxOfflineTtsWrapper { | @@ -93,12 +93,50 @@ func getTtsFor_en_US_amy_low() -> SherpaOnnxOfflineTtsWrapper { | ||
| 93 | return SherpaOnnxOfflineTtsWrapper(config: &config) | 93 | return SherpaOnnxOfflineTtsWrapper(config: &config) |
| 94 | } | 94 | } |
| 95 | 95 | ||
| 96 | +// https://k2-fsa.github.io/sherpa/onnx/tts/pretrained_models/vits.html#vits-melo-tts-zh-en-chinese-english-1-speaker | ||
| 97 | +func getTtsFor_zh_en_melo_tts() -> SherpaOnnxOfflineTtsWrapper { | ||
| 98 | + // please see https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-melo-tts-zh_en.tar.bz2 | ||
| 99 | + | ||
| 100 | + let model = getResource("model", "onnx") | ||
| 101 | + | ||
| 102 | + let tokens = getResource("tokens", "txt") | ||
| 103 | + let lexicon = getResource("lexicon", "txt") | ||
| 104 | + | ||
| 105 | + let dictDir = resourceURL(to: "dict") | ||
| 106 | + | ||
| 107 | + let numFst = getResource("number", "fst") | ||
| 108 | + let dateFst = getResource("date", "fst") | ||
| 109 | + let phoneFst = getResource("phone", "fst") | ||
| 110 | + let ruleFsts = "\(dateFst),\(phoneFst),\(numFst)" | ||
| 111 | + | ||
| 112 | + let vits = sherpaOnnxOfflineTtsVitsModelConfig( | ||
| 113 | + model: model, lexicon: lexicon, tokens: tokens, | ||
| 114 | + dataDir: "", | ||
| 115 | + noiseScale: 0.667, | ||
| 116 | + noiseScaleW: 0.8, | ||
| 117 | + lengthScale: 1.0, | ||
| 118 | + dictDir: dictDir | ||
| 119 | + ) | ||
| 120 | + | ||
| 121 | + let modelConfig = sherpaOnnxOfflineTtsModelConfig(vits: vits) | ||
| 122 | + var config = sherpaOnnxOfflineTtsConfig( | ||
| 123 | + model: modelConfig, | ||
| 124 | + ruleFsts: ruleFsts | ||
| 125 | + ) | ||
| 126 | + | ||
| 127 | + return SherpaOnnxOfflineTtsWrapper(config: &config) | ||
| 128 | +} | ||
| 129 | + | ||
| 96 | func createOfflineTts() -> SherpaOnnxOfflineTtsWrapper { | 130 | func createOfflineTts() -> SherpaOnnxOfflineTtsWrapper { |
| 131 | + // Please enable only one of them | ||
| 132 | + | ||
| 97 | return getTtsFor_en_US_amy_low() | 133 | return getTtsFor_en_US_amy_low() |
| 98 | 134 | ||
| 99 | // return getTtsForVCTK() | 135 | // return getTtsForVCTK() |
| 100 | 136 | ||
| 101 | // return getTtsForAishell3() | 137 | // return getTtsForAishell3() |
| 102 | 138 | ||
| 139 | + // return getTtsFor_zh_en_melo_tts() | ||
| 140 | + | ||
| 103 | // please add more models on need by following the above two examples | 141 | // please add more models on need by following the above two examples |
| 104 | } | 142 | } |
-
请 注册 或 登录 后发表评论