RepositoryKotlinDEGermany
hiteshsahu

hiteshsahu/Android-TTS-STT

One line solution for Android Text to speech(TTS) & Speech to Text(STT) translation problem

126stars
41forks
7issues
0views

Featured achievements

The project's latest awards

1
TINIX TRENDING·Topic: android-speech

#1 Repository of the month

1
TINIX TRENDING·Topic: speechtotext

#1 Repository of the month

1
TINIX TRENDING·Topic: texttospeech-android

#1 Repository of the month

Android Easy Text to Speech & Speech to Text without annoying dialog(TTS & STT)

Android TTS and STT is one line solution to convert text to speech(TTS) & speech to text(STT) in your Android App.

  • Convert Speech to text without annoying dialog.
  • Convert Text to Speech with error handling and callbacks
  • Written in Kotlin and compiled for upto Android 28.
  • TranslatorFactory class uses Factory pattern to create translators instances and use callbacks return success and error.

Usage

   //SPEECH TO TEXT DEMO
    speechToText.setOnClickListener({ view ->

        Snackbar.make(view, "Speak now, App is listening", Snackbar.LENGTH_LONG)
                .setAction("Action", null).show()

        TranslatorFactory
                .instance
                .with(TranslatorFactory.TRANSLATORS.SPEECH_TO_TEXT,
                        object : ConversionCallback {
                            override fun onSuccess(result: String) {
                                sttOutput.text = result
                            }

                            override fun onCompletion() {
                            }

                            override fun onErrorOccurred(errorMessage: String) {
                                erroConsole.text = "Speech2Text Error: $errorMessage"
                            }

                        }).initialize("Speak Now !!", this@HomeActivity)

    })


    //TEXT TO SPEECH DEMO
    textToSpeech.setOnClickListener({ view ->

        val stringToSpeak :String = ttsInput.text.toString()

        if (null!=stringToSpeak &&  stringToSpeak.isNotEmpty()) {

            TranslatorFactory
                    .instance
                    .with(TranslatorFactory.TRANSLATORS.TEXT_TO_SPEECH,
                            object : ConversionCallback {
                                override fun onSuccess(result: String) {
                                }

                                override fun onCompletion() {
                                }

                                override fun onErrorOccurred(errorMessage: String) {
                                    erroConsole.text = "Text2Speech Error: $errorMessage"
                                }

                            })
                    .initialize(stringToSpeak, this)

        } else {
            ttsInput.setText("Invalid input")
            Snackbar.make(view, "Please enter some text to speak", Snackbar.LENGTH_LONG).show()
        }

    })

Screenshots of Demo screen

Use in your project

Simply drop translation_engine package in your project and start using wherever you like. Dont forget to add RECORD_AUDIO permission in Maninfest. For Marshmallow and above you will need to request permission (refer abstract class BasePermissionActivity in the demo).

  <uses-permission android:name="android.permission.RECORD_AUDIO" />
  

Reference: https://stackoverflow.com/questions/6316937/how-can-i-use-speech-recognition-without-the-annoying-dialog-in-android-phones

Licence

   Copyright 2019 Hitesh Kumar Sahu

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

Similar Projects

Discover other similar projects and AI models.

RepositoryPython
huggingface/transformers

🤗 Transformers: the model-definition framework for state-of-the-art machine learning models in text, vision, audio, and multimodal models, for both inference and training.

169.5k
Dec 1, 2026
RepositoryC++
ggml-org/whisper.cpp

Port of OpenAI's Whisper model in C/C++

55.8k
Dec 1, 2026
RepositoryC++
ggml-org/whisper.cpp

Port of OpenAI's Whisper model in C/C++

55.8k
Dec 1, 2026
RepositoryKotlin
pilot51/voicenotify

Android app that speaks notifications

244
Nov 20, 2026
RepositoryPython
SYSTRAN/faster-whisper

Faster Whisper transcription with CTranslate2

27.2k
Nov 25, 2026
RepositoryC++
mozilla/DeepSpeech

DeepSpeech is an open source embedded (offline, on-device) speech-to-text engine which can run in real time on devices ranging from a Raspberry Pi 4 to high power GPU servers.

26.8k
Jun 19, 2025
RepositoryPython
m-bain/whisperX

WhisperX: Automatic Speech Recognition with Word-level Timestamps (& Diarization)

26.4k
Nov 21, 2026
RepositoryPython
modelscope/FunASR

Open-source speech recognition toolkit for training, inference, streaming ASR, VAD, punctuation, speaker diarization pipelines, and OpenAI-compatible/MCP serving.

21.2k
Nov 27, 2026
RepositoryTypeScript
leon-ai/leon

🧠 Leon is your open-source personal assistant.

17.7k
Nov 30, 2026