Comments (10)
I also encountered the same issue, but fortunately, I found the cause and fixed it. The crash here is caused by a null pointer, SherpaOnnxOfflineTtsWrapper.tts == nil, which is due to an incorrect configuration file passed during initialization. It seems that when you added files to the project, you selected "Create groups" in Xcode, which flattened the directory structure. The framework expects to access the directory /demo.app//espeak-ng-data/{target}, but the actual produced directory is /demo.app//{target}. This mismatch caused an error when passing /demo.app//espeak-ng-data as an argument to generate SherpaOnnxOfflineTtsVitsModelConfig, ultimately resulting in SherpaOnnxOfflineTtsWrapper.tts == nil.
My suggestion is to choose "Create folder references" when adding files and to check each path in func createOfflineTts() to ensure they are correct (you can directly call "FileManager.default.fileExists(atPath: path)"). If all paths are correct, the issue should be resolved.
Additionally, be cautious when using the two official demo methods func resourceURL(to path: String) -> String and func getResource(_ forResource: String, _ ofType: String) as they can be conflicting in some cases, where one expects correct input and the other expects incorrect input. You likely encountered this scenario. You should adapt these methods to fit your specific needs by obtaining the correct target path. You can refer to my modifications for guidance.
我也遇到了相同的问题,幸运的是我找到了原因并且修复了它。首先你这里崩溃的原因是空指针导致的,SherpaOnnxOfflineTtsWrapper.tts == nil,这是由于在它在 init 时传入的配置文件有误。你应该是在 add files to project 的时候选择了 “Create groups”,这会导致 XCode 完全打平目录,framework 希望访问的目录是 /demo.app//espeak-ng-data/{target} 但是实际生产的目录是 /demo.app//{target},这就导致当你把 /demo.app//espeak-ng-data 作为传入参数交给 framework 用于生成 SherpaOnnxOfflineTtsVitsModelConfig 时遭遇了错误,并最终导致 SherpaOnnxOfflineTtsWrapper.tts == nil。
所以我的建议是在你 add files 时选择 "Create folder references",并且在func createOfflineTts() 里面检查一下每个 path 是否正确(可以直接调用 "FileManager.default.fileExists(atPath: path)"),如果 path 都是正确的,那么问题就解决了。
此外,需要谨慎使用官方demo 的这两个方法 func resourceURL(to path: String) -> String 和 func getResource(_ forResource: String, _ ofType: String) -> String,在某些情况下这两个方法是互相矛盾的,也就是一个预期正确一个预期错误,你大概率就是遇到了这种情况。你需要结合你自己的实际情况,自己去获取争取的目标 path。这里你可以参考一下我的修改。
![image](https://private-user-images.githubusercontent.com/32445011/335984896-c4b6b633-f1de-4b8e-b9de-b9b641b56295.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTg3ODUzOTgsIm5iZiI6MTcxODc4NTA5OCwicGF0aCI6Ii8zMjQ0NTAxMS8zMzU5ODQ4OTYtYzRiNmI2MzMtZjFkZS00YjhlLWI5ZGUtYjliNjQxYjU2Mjk1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjE5VDA4MTgxOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTFhYmI2ODMyMTgxYTRiZDU3NzE0NmI4Yzc2ZWQ4NWUyODQ0Mzk5N2M4NzIxMTA1OTA1YTE2ZGQ2NGIwZmExZWImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.OEbbxKowAcAeP6IakhNU2J1GWQe2QBUUTNb0HoF5QAY)
from sherpa-onnx.
Please show the output of
git diff
and post the screenshot of your xcode project files so that we can see what files you have added to the project.
from sherpa-onnx.
Here is the output of git diff. I haven't made any change in the code. Just added the "en_US-amy-low" files to the project.
diff --git a/ios-swiftui/SherpaOnnxTts/SherpaOnnxTts.xcodeproj/project.pbxproj b/ios-swiftui/SherpaOnnxTts/SherpaOnnxTts.xcodeproj/project.pbxproj
index e9ea2c2..2d16d63 100644
--- a/ios-swiftui/SherpaOnnxTts/SherpaOnnxTts.xcodeproj/project.pbxproj
+++ b/ios-swiftui/SherpaOnnxTts/SherpaOnnxTts.xcodeproj/project.pbxproj
@@ -7,6 +7,364 @@
objects = {
/* Begin PBXBuildFile section */
+ 0C6857772BE75995002A7AC6 /* en_US-amy-low.onnx in Resources */ = {isa = PBXBuildFile; fileRef = 0C6855EB2BE75995002A7AC6 /* en_US-amy-low.onnx */; };
------ SKIPPED FOR READABLITLY ---------
sourceTree = "<group>"; };
+ 0C6857712BE75995002A7AC6 /* vi_dict */ = {isa = PBXFileReference; lastKnownFileType = file; path = vi_dict; sourceTree = "<group>"; };
+ 0C6857722BE75995002A7AC6 /* yue_dict */ = {isa = PBXFileReference; lastKnownFileType = file; path = yue_dict; sourceTree = "<group>"; };
+ 0C6857752BE75995002A7AC6 /* tokens.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = tokens.txt; path = "../../../vits-piper-en_US-amy-low/tokens.txt"; sourceTree = "<group>"; };
+ 0C6857762BE75995002A7AC6 /* en_US-amy-low.onnx.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = "en_US-amy-low.onnx.json"; path = "../../../vits-piper-en_US-amy-low/en_US-amy-low.onnx.json"; sourceTree = "<group>"; };
C917B4E12B0EEF3B005245AC /* SherpaOnnxTts.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SherpaOnnxTts.app; sourceTree = BUILT_PRODUCTS_DIR; };
C917B4E42B0EEF3B005245AC /* SherpaOnnxTtsApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SherpaOnnxTtsApp.swift; sourceTree = "<group>"; };
C917B4E62B0EEF3B005245AC /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
@@ -42,9 +758,664 @@
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
+ 0C6855EF2BE75995002A7AC6 /* aav */ = {
+ isa = PBXGroup;
+ children = (
+ 0C6855EC2BE75995002A7AC6 /* vi */,
+ 0C6856FA2BE75995002A7AC6 /* zac */,
+ );
+ path = "!v";
+ sourceTree = "<group>";
+ };
+ 0C6856FC2BE75995002A7AC6 /* voices */ = {
+ isa = PBXGroup;
+ children = (
+ 0C6856FB2BE75995002A7AC6 /* !v */,
+ );
+ path = voices;
+ sourceTree = "<group>";
+ };
+ 0C6857732BE75995002A7AC6 /* espeak-ng-data */ = {
+ isa = PBXGroup;
+ children = (
+ 0C6856922BE75995002A7AC6 /* lang */,
+ 0C6857722BE75995002A7AC6 /* yue_dict */,
+ );
+ name = "espeak-ng-data";
+ path = "../../../vits-piper-en_US-amy-low/espeak-ng-data";
+ sourceTree = "<group>";
+ };
C917B4D82B0EEF3B005245AC = {
isa = PBXGroup;
children = (
+ 0C6855EB2BE75995002A7AC6 /* en_US-amy-low.onnx */,
C9FE9FE82B0F3754009F1003 /* Frameworks */,
@@ -147,8 +1518,366 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
+ 0C6858BE2BE75996002A7AC6 /* qu_dict in Resources */,
+ 0C6858982BE75996002A7AC6 /* kk_dict in Resources */,
+ 0C6857F22BE75995002A7AC6 /* bs in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -291,6 +2020,7 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"SherpaOnnxTts/Preview Content\"";
+ DEVELOPMENT_TEAM = QSSSXUTZ8W;
ENABLE_PREVIEWS = YES;
FRAMEWORK_SEARCH_PATHS = "${PROJECT_DIR}/../../build-ios";
GENERATE_INFOPLIST_FILE = YES;
@@ -306,7 +2036,7 @@
);
MARKETING_VERSION = 1.0;
OTHER_LDFLAGS = "-lc++";
- PRODUCT_BUNDLE_IDENTIFIER = "com.k2-fsa.org.SherpaOnnxTts";
+ PRODUCT_BUNDLE_IDENTIFIER = com.test.SherpaOnnxTts;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OBJC_BRIDGING_HEADER = "${PROJECT_DIR}/../../swift-api-examples/SherpaOnnx-Bridging-Header.h";
@@ -323,6 +2053,7 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"SherpaOnnxTts/Preview Content\"";
+ DEVELOPMENT_TEAM = QSSSXUTZ8W;
ENABLE_PREVIEWS = YES;
FRAMEWORK_SEARCH_PATHS = "${PROJECT_DIR}/../../build-ios";
GENERATE_INFOPLIST_FILE = YES;
@@ -338,7 +2069,7 @@
);
MARKETING_VERSION = 1.0;
OTHER_LDFLAGS = "-lc++";
- PRODUCT_BUNDLE_IDENTIFIER = "com.k2-fsa.org.SherpaOnnxTts";
+ PRODUCT_BUNDLE_IDENTIFIER = com.test.SherpaOnnxTts;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OBJC_BRIDGING_HEADER = "${PROJECT_DIR}/../../swift-api-examples/SherpaOnnx-Bridging-Header.h";
Here is the xCode project files SS
Thank you so much for your help.
from sherpa-onnx.
Could you describe how you added espeak-ng-data? Make.sure it is not a symlink.
Could you delete it and add it again?
Check that the reported file.in.the.error log does exist.
from sherpa-onnx.
Here is how i added espeak-ng-data to the project.
- Downloaded the model file
vits-piper-en_US-amy-low.tar.bz2
fromhttps://github.com/k2-fsa/sherpa-onnx/releases/tag/tts-models
- After extraction, from xCode, used the option
Add files to 'SherpaOnnxTts'
by selecting en_US-amy-low.onnx, en_US-amy-low.onnx.json, tokens.txt and espeak-ng-data folder.
When I check the espeak-ng-data folder, I'm able to see the 'phontab' file inside.
I also tried deleting espeak-ng-data folder reference from xcode and added again. Still the same issue.
Am I taking the right approach to adding the espeak-ng-data folder?
from sherpa-onnx.
Could.you use
ls -lh to check the file in the error.log.
Remember to copy and paste the absolute path from.the.error.log.
from sherpa-onnx.
I checked for the file in the log '/private/var/containers/Bundle/Application/32C03D12-4D6E-4296-9192-F7452BBD0A7B/SherpaOnnxTts.app/espeak-ng-data/phontab' does not exist.
when I ls -lh the full path, its showing error as No such file or directory
.
I also tried removing the espeak-ng-data
reference from xcode by deleting it. Still the same error. So I am assuming, the folder reference is not properly added with my steps. Can you pls tell me what is the right approach to adding the espeak-ng-data
to the xcode? or something else I'm missing here?
I also tried by downloading the espeak-ng-data
directly from https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/espeak-ng-data.tar.bz2
.
from sherpa-onnx.
Pleasr check the paths in your git diff output.
The../../../ relative path looks suspicious.
from sherpa-onnx.
Pleasr check the paths in your git diff output.
The../../../ relative path looks suspicious.
from sherpa-onnx.
The../../../ relative path looks suspicious.
the vits-piper-en_US-amy-low
folder is outside the sherpa-onnx
and from that location only the en_US-amy-low.onnx
file being loaded.
Can you please advise me what is the right way of adding the en_US-amy-low.onnx
and its supporting files including the espeak-ng-data
folder?
i followed https://www.youtube.com/watch?v=MvePdkuMNJk for getTtsForVCTK
and its working perfectly.
from sherpa-onnx.
Related Issues (20)
- 在做ASR时,如果对麦克风收音做降噪处理? HOT 2
- TTS,除了命令行调用外,能否在Python里直接调用?想避免模型重复加载耗时 HOT 4
- [Help wanted] Add OnlineNeMoCtcModelConfig to C API
- [Help wanted] Flutter APP for text-to-speech HOT 1
- 把SherpaOnnx 样例的Android kotlin代码转成Java就无法识别声音 HOT 3
- 如何调节输出音频的音量 HOT 1
- The command line tool named 'sherpa-onnx-cli' for convert the original keywords to tokens HOT 2
- Keyword spotting:iOS的keywords模型有吗 HOT 1
- Could you upload the apk of the latest update HOT 6
- swift api 中的hotwords,等同kotlin里的keywords吗 HOT 2
- I'm searching for the sherpa app in which the user can load a gguf model locally and chat with it using text messages HOT 1
- ImportError: ../../../_deps/onnxruntime-src/lib/libonnxruntime_providers_cuda.so: cannot open shared object file: No such file or directory HOT 54
- 发型的paraformer 2pass apk包,这个paraformer是large模型吗 HOT 2
- Getting end timestamp in result(s) HOT 2
- Runtime option to disable sherpa logs HOT 2
- Import Piper / VITS as iOS Custom System Voices for TTS using AVSpeechSynthesisProviderAudioUnit Extension in Swift HOT 1
- Convert new piper tts models. HOT 1
- Multi-language support issue with Sherpa ONNX conversion (on android device) HOT 3
- Use offline model to stream online HOT 1
- Errors and Questions regarding exporting a model HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sherpa-onnx.