Comments (6)
Sorry, I cannot access your link.
I just tested it locally on my macOS and it works perfectly.
dotnet run \
--vits-model=./vits-piper-ru_RU-irina-medium/ru_RU-irina-medium.onnx \
--vits-tokens=./vits-piper-ru_RU-irina-medium/tokens.txt \
--vits-data-dir=./vits-piper-ru_RU-irina-medium/espeak-ng-data \
--debug=1 \
--output-filename=./hi.wav \
--text="Как твои дела?"
It produces
hi.wav.txt
(Please rename it to hi.wav
.)
Please make sure you use utf-8
encoding for your computer.
Please see the doc
https://k2-fsa.github.io/sherpa/onnx/tts/faq.html#how-to-enable-utf-8-on-windows
Sorry that this specific part is in Chinese. Many Chinese users have issues using the Chinese TTS models before making the changes to their computers to use UTF-8 encoding.
from sherpa-onnx.
The C++ code expects string in UTF-8 encoding.
The code works fine on my macOS without any system changes. I am unsure why it causes issues on your and some other users' systems.
C# uses UTF-16 encoded strings.
The following line
sherpa-onnx/scripts/dotnet/offline.cs
Line 235 in 4f758e6
does the conversion automagically from UTF-16 to UTF-8.
but without touching windows settings
Sorry, I've no idea about how to fix it by changing the code (if it is indeed caused by code).
You can try reading the text from a utf-8 encoded file and see if it works.
from sherpa-onnx.
Could you describe which model you are using?
from sherpa-onnx.
Could you describe which model you are using?
Of course! Lets make it clear: I am able to reproduce it with every of 4 RU-lang models. However, for the sake of analysis, lets say it is:
- vits-piper-ru_RU-irina-medium.tar.bz2
Here is how it sounds with sherpa-onnx-non-streaming-tts-x64-v1.9.23.exe.
And here is what I got with c# (tried running both ways from .bat AND directly from code).
It is also absurdly longer (x6 times) than it should be in comparison to the right version.
One more thing that I can tell you is that vocal output is still not totally random. I can definitely hear every of 4 models speak the same thing, just not in Russian. Looks like, as if it lacks some pointer to specific language (in order to utilize related espeak-ng-data) with c# sample, while sherpa-onnx-non-streaming-tts-x64-v1.9.23.exe somehow manages to get it right by itself.
from sherpa-onnx.
Sorry, I cannot access your link.
I just tested it locally on my macOS and it works perfectly.
dotnet run \ --vits-model=./vits-piper-ru_RU-irina-medium/ru_RU-irina-medium.onnx \ --vits-tokens=./vits-piper-ru_RU-irina-medium/tokens.txt \ --vits-data-dir=./vits-piper-ru_RU-irina-medium/espeak-ng-data \ --debug=1 \ --output-filename=./hi.wav \ --text="Как твои дела?"
It produces hi.wav.txt
(Please rename it to
hi.wav
.)Please make sure you use
utf-8
encoding for your computer.Please see the doc https://k2-fsa.github.io/sherpa/onnx/tts/faq.html#how-to-enable-utf-8-on-windows
Sorry that this specific part is in Chinese. Many Chinese users have issues using the Chinese TTS models before making the changes to their computers to use UTF-8 encoding.
Wow, enforcing utf-8 actually helped! Thank you!
Here is the final question then: maybe you got an idea as if there is some way to do the same, but without touching windows settings? I mean, somehow enforce utf-8 encoding from code, while passing such options.text param to sherpa? Or maybe I can somehow pass not string, but path to text file containing text to be spoken, while ensuring this specific file is utf-8 encoded?
I am asking, because sherpa-onnx-non-streaming-tts-x64-v1.9.23.exe managed to do right without any windows setting manipulation.
from sherpa-onnx.
The code works fine on my macOS without any system changes. I am unsure why it causes issues on your and some other users' systems.
I also can suppress this issue for myself if enforce UTF-8 (codepage 65001) system-wide (following the instruction from the link you provided). Thanks for that, once again. But I want to also embed sherpa-onnx into my software to be shared with other people and it would be incredibly awkward to ask every potential user to "go here and click that then reload" or "I played a little bit with your registry so now you need to reload and then application can finally work as intended". That's why I keep looking for solution.
C# uses UTF-16 encoded strings.
The following line
sherpa-onnx/scripts/dotnet/offline.cs
Line 235 in 4f758e6
does the conversion automagically from UTF-16 to UTF-8.
As I understand it, the problem is not in the C++ code, but on the side of C#, which due to the nature of UTF-16 strings incorrectly translates Cyrillic characters (and possibly Chinese characters too) when the system is not set to force everything to work on UTF-8 (codepage 65001).
You can try reading the text from a utf-8 encoded file and see if it works.
I tried a lot, with files, encoding focuses and so on. Unfortunately, no remedy found here.
Could you please consider adding another variant of SherpaOnnxOfflineTtsGenerate, for example SherpaOnnxOfflineTtsGenerateFromFile, which instead of literal text to voice will expect a path to a text file from string
argument, from which C++ will extract the text to be voiced?
That way, I think we can get around this problem by simply using a text file with fixed utf-8 encoding as a proxy.
from sherpa-onnx.
Related Issues (20)
- Android TTS crash HOT 4
- TTS model sweetbbak-amy en_GB has ver long 5+ second pauses after every sentence. HOT 19
- Looking for inbrowser speech aligner
- Python Demo Error HOT 7
- When will speaker identification functionality be supported in the C# version of sherpa-onnx? HOT 1
- Error while clicking Generate on IOS-SwiftUI TTS HOT 10
- [Request] Nodejs ws offline example
- need b4a example HOT 1
- VS2022 使用静态库编译MFC例程成功,使用动态库编译失败 HOT 10
- 使用 sherpa-onnx-streaming-zipformer-multi-zh-hans-2023-12-12 模型,热词异常 HOT 5
- Decoding method 'modified_beam_search' gives letters/words on silence, while 'greedy_search' works well HOT 17
- TTS WebAssembly for other languages not work HOT 10
- sherpa-onnx-offline-tts: Allow piping text using cat or text file input with command line parameter HOT 5
- sherpa-onnx-offline-tts: Allow piping audio from tts directly to stdout for further processing
- tts: Increase TTS volume to 0 DB. HOT 2
- Android TTS: Some ideas for packaging tts engine and voices/models HOT 2
- TTS: Add a SAPI 5 driver for Windows HOT 2
- sherpa-onnx-keyword-spotter 使用命令行工具 识别结果找不到 HOT 1
- 麦克风采样率和通道数的设置问题 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.