Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
Sichere ProgrammierungI audited my own ML linter and had to withdraw its best evidence(21.09.2026 um 22:54 Uhr)
Sichere ProgrammierungQuantum Result Validation for Distributed Computing Systems(21.09.2026 um 22:54 Uhr)
Sichere ProgrammierungJWT Authentication and Role-Based Access Control in LocalHands(21.09.2026 um 22:56 Uhr)
Sichere ProgrammierungStochastic Parrot or Alien Mind?(21.09.2026 um 22:56 Uhr)
Sichere ProgrammierungBuilding AI for the Physical World Is a Different Engineering Problem(21.09.2026 um 22:58 Uhr)
Sichere ProgrammierungI audited my own ML linter and had to withdraw its best evidence(21.09.2026 um 22:54 Uhr)
Sichere ProgrammierungQuantum Result Validation for Distributed Computing Systems(21.09.2026 um 22:54 Uhr)
Sichere ProgrammierungJWT Authentication and Role-Based Access Control in LocalHands(21.09.2026 um 22:56 Uhr)
Sichere ProgrammierungStochastic Parrot or Alien Mind?(21.09.2026 um 22:56 Uhr)
Sichere ProgrammierungBuilding AI for the Physical World Is a Different Engineering Problem(21.09.2026 um 22:58 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

Translate speech to any language (Google supported) with Python and Google Translate API

In this article, we are going to create a speech translator with python using the Google translate API Installation (Linux): — pip install SpeechRecognition — pip install googletrans — pip install gTTS — pip install playsou…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

Image description

In this article, we are going to create a speech translator with python using the Google translate API



Installation (Linux):

— pip install SpeechRecognition

— pip install googletrans

— pip install gTTS

— pip install playsound



Installation (Windows):

— pip install SpeechRecognition

— pip install gTTS

— pip install pipwin

— pipwin install pyaudio

— pip install playsound==1.2.2

— pip install googletrans==4.0.0-rc1



Lets import the required modules




import speech_recognition as sr
from googletrans import Translator
from gtts import gTTS
from playsound import playsound






Create an object of the translator class




translator = Translator()






We will now use the default microphone as the audio source, listen to the phrase and extract it into audio data




r = sr.Recognizer()
with sr.Microphone() as source:
print("Speak Now:")
audio = r.listen(source)






Set the destination language, you can get a list of all language codes here [https://meta.wikimedia.org/wiki/Template:List_of_language_names_ordered_by_code]




language_to_translate='en'






The below section will print the recognized speech, set the language to be translated to and use the google API to to translate the recognized speech. We will also print the detected text and the translated text on the console




print("Recognized as: ", r.recognize_google(audio))
language = language_to_translate
translations = translator.translate(r.recognize_google(audio), dest=language)
print(translations.origin, ' -> ', translations.text)






Finally we will save the translated text as an mp3 audio file using Google Text-to-Speech and then play it using the playsound library




myobj = gTTS(text=translations.text, lang=language)
myobj.save(tr + ".mp3")
playsound(tr + ".mp3")






*Complete Code:

*





import speech_recognition as sr
from googletrans import Translator
from gtts import gTTS
from playsound import playsound

translator = Translator()
r = sr.Recognizer()
with sr.Microphone() as source:
print("Speak Now:")
audio = r.listen(source)

language_to_translate='en'
try:
print("Recognized as: ", r.recognize_google(audio))
language = language_to_translate
translations = translator.translate(r.recognize_google(audio), dest=language)
print(translations.origin, ' -> ', translations.text)
myobj = gTTS(text=translations.text, lang=language)
myobj.save(tr + ".mp3")
playsound(tr + ".mp3")
except Exception as e:
print(e)


Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Translate speech to any language (Google supported) with Python and Google Translate API

Thematisch verwandte Begriffe: Translate, speech, language, Google · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-79918 | MaxKB is an open-source AI assistant for enterprise. Prior to version 2.…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick