Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add iOS example for Kokoro TTS #1737

Merged
merged 1 commit into from
Jan 20, 2025
Merged

Conversation

csukuangfj
Copy link
Collaborator

Steps to run it on the iOS simulator inside xcode

1. Download and build the code

mkdir -p ~/open-source/
cd ~/open-source
git clone https://github.com/k2-fsa/sherpa-onnx
cd sherpa-onnx
./build-ios.sh

2. Download the tts model

Please refer to
https://k2-fsa.github.io/sherpa/onnx/tts/pretrained_models/kokoro.html#kokoro-en-v0-19-english-11-speakers
to download models.

mkdir -p ~/open-source/icefall-models
cd ~/open-source/icefall-models

wget https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/kokoro-en-v0_19.tar.bz2
tar xf kokoro-en-v0_19.tar.bz2
rm kokoro-en-v0_19.tar.bz2

Note that you can put model files anywhere you like. We use ~/open-source/icefall-models as an example

3. Start xcode

Start xcode and open the project
https://github.com/k2-fsa/sherpa-onnx/tree/master/ios-swiftui/SherpaOnnxTts

Screenshot 2025-01-20 at 12 46 13

4. Add the TTS model to the project

Screenshot 2025-01-20 at 12 47 28 Screenshot 2025-01-20 at 12 48 41 Screenshot 2025-01-20 at 12 49 53

5. Check model files and run it

Screenshot 2025-01-20 at 12 52 07 Screenshot 2025-01-20 at 12 52 33

The version of xcode I am using is
Screenshot 2025-01-20 at 12 54 01

@csukuangfj
Copy link
Collaborator Author

A video demo is given below

kokoro-ios-with-sherpa-onnx.mp4

@csukuangfj csukuangfj merged commit a2650b7 into k2-fsa:master Jan 20, 2025
@csukuangfj csukuangfj deleted the ios-kokoro branch January 20, 2025 05:12
@lijianfeigeek
Copy link

If you are using Xcode16.2 and iOS 18.2 simulator, please configure it like this.
image

@csukuangfj
Copy link
Collaborator Author

@lijianfeigeek

Thank you for the info!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants