-
Notifications
You must be signed in to change notification settings - Fork 528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Java support ? #247
Comments
Using ONNX from Java would be straightforward. The harder part would be using piper-phonemize to convert text to phonemes. |
We will need to make piper as a library and wrap it as a java native interface and also piper_phonemize should expose c-api functions. However for jni it is not strictly necessary, as it can work with c++ sources directly, there might be problems for example with other possible wrappers like swift-pm, so it would be good to have a native library with c-api exports. |
i already did java version.I will release it |
I'm also interested in Java interface and native Piper library. I'd like to make it into an installable TTS Engine for Android system, licensed under open source of course, and free. It could be then used in apps like my @voice Aloud Reader on Android to read articles, books etc. Or in many other such apps available in Google Play. Actually if someone would be interested in creating an Android APK or AAB package for installing Piper TTS on Android, I'd pay for the work within my humble means... I could do this job myself, if I could find time for it. However I would need a list of all the source files and libraries (and source files within them) that needs to be compiled into a Piper TTS library, so that it could be compiled for Android (ARM and Intel processors) and the Java or Kotlin TTS API wrapper could then be added... Greg |
Interesting, thank you! I see that they created separate apps (APK files) for several voices, just to try them by typing/pasting a text into their window and then pressing Play to listen. It could be a start for a true Android TTS engine, which would let the user download any pre-built voices (e.g. from GitHub) and then use them a high quality TTS, generated locally, therefore free, in any app that needs TTS service.
Time permitting I’ll try to learn more and see if I could create such Piper TTS Engine for Android, and if it works well – upload to Google Play. This would be a real help to many users – currently the really high quality “neural” voices are available only at network voices – send text to some servers, obtain speech data to make sounds. It’s free for Google TTS packages, you have to pay $$$ if you want to use other services (e.g. Microsoft Azure TTS, Amazon Polly…) And still the inconvenience of having to have a very good net connection to listen.
Greg
From: Fangjun Kuang ***@***.***) ***@***.***>
Sent: Monday, November 13, 2023 10:31 PM
To: rhasspy/piper ***@***.***>
Cc: Greg Kochaniak ***@***.***>; Mention ***@***.***>
Subject: Re: [rhasspy/piper] Java support ? (Issue #247)
@gregko <https://github.com/gregko>
Please have a look at #257 <#257>
sherpa-onnx is fully open-sourced and it is free. It provides jni interface and kotlin APIs.
—
Reply to this email directly, view it on GitHub <#247 (comment)> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/AANKO7HROJUH2DMMLDC7ZT3YELQYBAVCNFSM6AAAAAA6KLE2GOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMBZGQ4DSMZYG4> .
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Well so i will release it asap... |
I'm interested in Android platform (Intel and ARM processors), not rasberrypi... I imagine compiling Piper as a shared library (.so) for Android, then creating Java or Kotlin interfaces for it, where needed. @csukuangfj mentions another project, sherpa-onnx, which seems to be much bigger (includes also speech to text conversion, which I don't need), and can use Piper voices after some conversion. For now I don't know much more. Maybe converting Piper to Android shared library would be simpler. Greg |
sherpa is good of course and thanks to @csukuangfj but it contains unnecesary things unrelated to tts and i don't like an idea of lexicon stuff. I almost finished a C-library for piper, and jni should not be hard to do after that. However, @eix128, If you already have it, please open a pr or give us the link where we could download your wrapper and adapt to android tts api. Thanks |
By the way, you can try different voices at https://huggingface.co/spaces/k2-fsa/text-to-speech |
Yes, going to a C library through Java JNI is not a problem for me. I would be grateful if you could also share the source tree and all the build scripts, so that I could build Piper shared libraries myself, when needed, or update them if improvement to Piper are released in the future. Thank you, everyone, for your help and tips!
Greg
From: Beqa Gozalishvili ***@***.***) ***@***.***>
Sent: Tuesday, November 14, 2023 11:01 AM
To: rhasspy/piper ***@***.***>
Cc: Greg Kochaniak ***@***.***>; Mention ***@***.***>
Subject: Re: [rhasspy/piper] Java support ? (Issue #247)
sherpa is good of course and thanks to @csukuangfj <https://github.com/csukuangfj> but it contains unnecesary things unrelated to tts and i don't like an idea of lexicon stuff.
I almost finished a C-library for piper, and jni should not be hard to do after that.
However, @eix128 <https://github.com/eix128> , If you already have it, please open a pr or give us the link where we could download your wrapper and adapt to android tts api.
Thanks
—
Reply to this email directly, view it on GitHub <#247 (comment)> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/AANKO7HRNP2IQKNGB6RHZATYEOIS7AVCNFSM6AAAAAA6KLE2GOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJQGUZDKOBZGM> .
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
@gregko do you know another way of using a shared lib without JNI? I know there is fma, but i am not sure android supports it |
Do you mean using such library from Java? Or using it on Android system, which would be the same thing? I don't know about anything else but JNI, that is declaring C or C++ functions in a special way, to make them callable from Java. I don't know what fma is. |
@gregko You can find a YouTube video below: |
Well , i have finished windows and linux x64 versions on java. |
Sounds good. Is your code for Windows and Linux, or from calling from Java, available somewhere to play with? |
@eix128 what do you mean without copying? Could you open this? It would be interesting to see. |
We don't need a lexicon.txt anymore. We also support piper-phonemize in sherpa-onnx for models from piper. All models from piper are supported in sherpa-onnx. |
FYI: Now we also provide Java APIs for piper TTS models. You don't need to know Kotlin to use it. It is pure Java. https://github.com/k2-fsa/sherpa-onnx/blob/master/java-api-examples/NonStreamingTtsPiperEn.java |
How can we implement it in java ?
its onnx ,
there is some sample example:
https://github.com/snakers4/silero-vad/tree/master/examples/java-example
I think it wont be too hard to make piper avalible to use in java because of onnx?
The text was updated successfully, but these errors were encountered: