Offline real-time Speech-to-Text for Termux using whisper.cpp.
- Real-time microphone transcription
- Voice-activated recording
- Offline speech recognition
- Low latency
- Lightweight setup
- Runs fully inside Termux
- Android device
- Termux
- Termux:API app
- Internet connection for initial setup only
Install the App Termux and Termux-api: Termux Termux-api
Then install the package inside Termux:
pkg install git python termux-apiClone the repo:
git clone https://github.com/opsonusdh/Termux-STT/
cd Termux-STT/Run:
bash setup.shThis script will:
- Install required Termux packages
- Install Python dependencies
- Ask microphone permission
- Clone
whisper.cpp - Build whisper.cpp binaries
- Download the Whisper model of your choice
The initial setup may take several minutes depending on your device performance and internet connection.
Some older devices may take longer during compilation because compiling C++ on a phone is exactly as unreasonable as it sounds.
If you want faster transcription with high precision, you can use groq. just do:
nano api.keyshere add all groq API keys you have:
gsk_
gsk_
...
Start the application:
python main.pyor, as a module:
from main import listen
for text in listen(once=False):
print("User said:")
print(text)The program will continuously listen for speech using your device microphone.
When speech is detected:
- Audio recording starts automatically
- Speech audio is buffered temporarily
- Silence stops the recording
- The recorded audio is transcribed locally using
whisper.cpp
The entire pipeline runs offline after setup.
Termux-STT/
├── main.py
├── requirements.txt
├── download_model.sh
└── setup.sh
- Fully offline after installation
- Optimized for low latency
- Tiny model prioritizes speed and low RAM usage
- Works best in quieter environments
Sounds such as keyboards, fans, traffic, birds, or other environmental noise may occasionally trigger speech detection depending on your threshold settings. Tiny models are surprisingly capable, but not psychic. Yet.
- Proper Voice Activity Detection (VAD)
- Wake-word activation
- Streaming transcription
- Multi-language support
- Live subtitle mode
- Terminal overlay interface
-
whisper.cpp https://github.com/ggerganov/whisper.cpp
-
OpenAI Whisper
-
Groq
MIT
Do whatever you want, just don't be evil.
- It is intended to integrate with other Termux projects, including Termux-TUI.
- Improvements, suggestions, and testing are welcome.