https://github.com/daslearning-org/text-to-speech-offline
A lightweight cross-platform Text-To-Speech application which works on Android native TTS and uses PiperTTS on desktop environment. The app looks like a simple chatbot made on kivy & kivymd which are based on Python. This app can also work Offline depending on the selected models. We will also include Speech-To-Text feature soon.
https://github.com/daslearning-org/text-to-speech-offline
cross-platform kivy-application kivymd mobile-app python speech-synthesis speech-to-text text-to-speech tts tts-android
Last synced: about 2 months ago
JSON representation
A lightweight cross-platform Text-To-Speech application which works on Android native TTS and uses PiperTTS on desktop environment. The app looks like a simple chatbot made on kivy & kivymd which are based on Python. This app can also work Offline depending on the selected models. We will also include Speech-To-Text feature soon.
- Host: GitHub
- URL: https://github.com/daslearning-org/text-to-speech-offline
- Owner: daslearning-org
- License: mit
- Created: 2025-08-08T15:00:32.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-08-08T15:50:09.000Z (10 months ago)
- Last Synced: 2025-08-08T17:36:58.963Z (10 months ago)
- Topics: cross-platform, kivy-application, kivymd, mobile-app, python, speech-synthesis, speech-to-text, text-to-speech, tts, tts-android
- Language: Python
- Homepage: https://daslearning.in
- Size: 88.9 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ⌨️ ➜ 🔊 Offline Text to Speech Application
Your private offline Text-To-Speech app for Android, Linux, Windows. The application is made with [Kivy](https://kivy.org/) and [KivyMD](https://kivymd.readthedocs.io/en/latest/) on Python.
> Overview: The app uses KivyMD and Kivy mainly for the AI Chatbot UI. It mainly uses [PiperTTS](https://github.com/OHF-Voice/piper1-gpl) on Desktop environments and native [Android-TTS](https://developer.android.com/reference/android/speech/tts/TextToSpeech) on `Android` platform.
## 📽️ Demo
You can click on the below Image or this [Youtube Link](https://www.youtube.com/watch?v=AhcjJu2YwUE) to see the demo. Please let me know in the comments, how do you feel about this App.
[](https://www.youtube.com/watch?v=AhcjJu2YwUE)
## 🖧 Our Scematic Architecture
To be added...
## 🧑💻 Quickstart Guide
### 📱 Download & Run the Android App
Get the app from [Google PlayStore](https://play.google.com/store/apps/details?id=in.daslearning.ttssts)
[](https://play.google.com/store/apps/details?id=in.daslearning.ttssts)
You can also check the [Releases](https://github.com/daslearning-org/text-to-speech-offline/releases) and downlaod the latest apk.
> If you use the `Download` button from the app, you can save the selected audio (.wav) in one of the mentioned folders: `Downloads`, `Music`, `Podcasts`, `Recordings` or `Ringtones` due android file access restrictions. It defaults to `TTS` folder in `Music`.
> If you have a `Samsung` phone (or some other brand's phone) which doesn't have `Google` as default text-to-speech engine. You may change it to google to get more voices. Go to `Settings` > `Accessibility` > `Talkback` > `Settings` > `text-to-speech settings`> `Preferred engine` > then choose `Google` as default engine. If you do not find this path, directly search `text-to-speech settings` in `Settings`.
### 💻 Download & Run the Windows or Linux App
Get the app from [Microsoft App Store](https://apps.microsoft.com/detail/9nbx1dwkc4fj?referrer=appbadge&mode=direct&hl=en-GB&gl=IN)
[](https://apps.microsoft.com/detail/9nbx1dwkc4fj?referrer=appbadge&mode=direct&hl=en-GB&gl=IN)
You can also check the [Releases](https://github.com/daslearning-org/text-to-speech-offline/releases) and downlaod the latest version of the application on your computer. If you are on `Windows`, download the `dlTTS_x.x.x.exe` file & double click to run it. If you are on `Linux`, download `dlTTS_Linux_XXX` file and run it.
#### Notes:
- Some Antivirus softwares might give you detection alert for the exe (happens for PyInstaller apps), you need to add an exception in that case.
- On Linux you may need to change file permission to execute it.
```bash
chmod +x dlTTS_Linux_XXX
./dlTTS_Linux_XXX
```
### 🐍 Run with Python
1. Clone the repo
```bash
git clone https://github.com/daslearning-org/text-to-speech-offline.git
```
2. Run the application as show below & you can download the voice models from settings of the app.
```bash
cd text-to-speech-offline/kivy/
pip install -r requirements.txt # virtual environment is recommended
python main.py
```
## 🦾 Build your own App
The Kivy project has a great tool named [Buildozer](https://buildozer.readthedocs.io/en/latest/) which can make mobile apps for `Android` & `iOS`
### 📱 Build Android App
A Linux environment is recommended for the app development. If you are on Windows, you may use `WSL` or any `Virtual Machine`. As of now the `buildozer` tool works on Python version `3.11` at maximum. I am going to use Python `3.11`.
```bash
# add the python repository
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
# install all dependencies.
sudo apt install -y ant autoconf automake ccache cmake g++ gcc git lbzip2 libffi-dev libltdl-dev libtool libssl-dev make openjdk-17-jdk patch patchelf pkg-config python3-pip python3.11 python3.11-venv python3.11-dev unzip wget zip
# optionally you may check the java installation with below commands
java -version
javac -version
# install python modules
git clone https://github.com/daslearning-org/text-to-speech-offline.git
cd text-to-speech-offline/kivy/
python3.9 -m venv .env # create python virtual environment
source .env/bin/activate
pip install -r req_android.txt
# build the android apk
buildozer android debug # this may take a good amount of time for the first time & will generate the apk in the bin directory
```
### 🖳 Build Computer Application (Windows / Linux / MacOS)
#### Build simple executable (single file)
A `Python` virtual environment is recommended and please follow the same steps from above till the pip module installations (do not require buildozer for desktop apps). It builds a native app depending on the OS type i.e. `.exe` if you are running `PyInstaller` from a Windows machine. You may use this [docker image](https://hub.docker.com/r/cdrx/pyinstaller-windows) for Windows exe.
```bash
# install pyinstaller
pip install pyinstaller
# generate the spec file
pyinstaller --name "pyinst-single" --windowed --onefile main.py # optional as it is already create in the repo
# then update the spec file as needed
# then build your app which will be native to the OS i.e. Linux or Windows or MAC
pyinstaller pyinst-single.spec
```
#### Creating `MSIX` installer for Microsoft Store
1. Creating an installer exe using [inno setup](https://jrsoftware.org/isinfo.php) and we are using this [spec file](./kivy/msi-inno.iss)
2. Create self signed certificate. Once `.cer` is generated > double click > Install > Local Machine > Trusted People.
```powershell
# New certificate
$cert = New-SelfSignedCertificate `
-Type CodeSigning `
-Subject "CN=DasLearning, O=DasLearning, C=IN" `
-CertStoreLocation "Cert:\LocalMachine\My" `
-NotAfter (Get-Date).AddYears(5)
# User a strong password
$password = ConvertTo-SecureString "StrongPassword123!" -AsPlainText -Force
# Export teh certificate
Export-PfxCertificate `
-Cert $cert `
-FilePath ".\dlTTS.pfx" `
-Password $password
# Local installation certificate
Export-Certificate `
-Cert $cert `
-FilePath ".\dlTTS.cer"
# Optiona: check the pfx cert
Get-PfxCertificate -FilePath ".\dlTTS.pfx" |
Format-List Subject, NotBefore, NotAfter
```
3. We will be using [MSIX Packaing Tool](https://apps.microsoft.com/detail/9n5lw3jbcxkf?hl=en-GB&gl=IN) to create the MSIX package. Install it & follow the wizard.
4. Use `http://timestamp.digicert.com` in the timestamp server. Use your details & Generate the MSIX.
#### Build Windows exe from Linux
* Install Wine
```bash
# Add the Wine repository key
sudo mkdir -pm755 /etc/apt/keyrings
sudo wget -O /etc/apt/keyrings/winehq-archive.key https://dl.winehq.org/wine-builds/winehq.key
# Add the Wine repository for your Linux Mint version
# For Linux Mint 21.x (Vanessa, Virginia, Victoria - based on Ubuntu 22.04 Jammy Jellyfish)
# Replace 'jammy' with your Ubuntu base codename if different (e.g., 'focal' for Mint 20.x)
sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/jammy/winehq-jammy.sources
# Update package lists
sudo apt update
# Install Wine (Stable branch is usually recommended)
sudo apt install --install-recommends winehq-stable
# If you need 32-bit support (highly recommended for Python/PyInstaller compatibility)
# This command typically handles it, but if you encounter issues later, ensure 32-bit architecture is enabled:
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install wine32 # This might be pulled by winehq-stable, but good to ensure
```
* Download Windows Python from [official page](https://www.python.org/downloads/windows/) and then install
```bash
# Navigate to where you downloaded the Python installer
cd ~/Downloads
# Run the installer using wine
# Replace 'python-3.9.13-amd64.exe' with the actual filename you downloaded
wine python-3.9.13-amd64.exe
```
* Then run the development
```bash
cd kivy/
wine pip install pyinstaller
wine pip install -r requirements.txt
# Also install kivy-deps.sdl2, kivy-deps.glew, kivy-deps.angle explicitly if not pulled by Kivy/KivyMD
wine pip install kivy-deps.sdl2 kivy-deps.glew kivy-deps.angle
# Replace 'Python39' with your installed Python version in Wine
wine pyinstaller dasLearningTTS.spec # exe will be in the dist folder
```
## 🐞 Issues
There can be few issues & some solutions around it.
### Android Issues
* Sometimes the apk might not get installed. You may enable `Developer Options` > `USB Debugging` and run below command with [adb tool](https://developer.android.com/tools/adb).
```bash
# check your packages (it may not show the uninstalled version, some leftover may cause the issue)
adb shell pm list packages | grep ttsstt
# uninstall cleans it
adb uninstall in.daslearning.ttsstt
# you may use buildozer deploy run to check the adb
buildozer android debug deploy run
```
## Reference links
- Piper-TTS [voices-list](https://huggingface.co/rhasspy/piper-voices/blob/main/voices.json)
- Listen to [voice samples](https://rhasspy.github.io/piper-samples/)
- Piper-TTS [GitHub](https://github.com/OHF-Voice/piper1-gpl)