diff --git a/README.md b/README.md index 7f6de0b..21cfcdd 100644 --- a/README.md +++ b/README.md @@ -38,5 +38,6 @@ sudo apt-get install python3-pyaudio ``` ## Example tasks -- what wifi am I connected with on Linux -- \ No newline at end of file +- What WiFi am I connected with (on Linux)? +- Tell me a short story! +- Translate "Hello there"! diff --git a/violet/stt.py b/violet/stt.py index 0b6d2bc..bf41c95 100644 --- a/violet/stt.py +++ b/violet/stt.py @@ -7,7 +7,7 @@ def ask() -> str: with sr.Microphone() as source2: recognizer.adjust_for_ambient_noise(source2, duration=1) recording = recognizer.listen(source2, timeout=5) - return recognizer.recognize_google(recording, language='de-DE') + return recognizer.recognize_google(recording, language='en-US') # lang.detect(text)[1] except sr.RequestError: return 'I did not understand what you said.' diff --git a/violet/tts.py b/violet/tts.py index 06a09b4..5b49fa3 100644 --- a/violet/tts.py +++ b/violet/tts.py @@ -2,9 +2,13 @@ import os import gtts import playsound -def say(text): - tts = gtts.gTTS(text=text, lang='de') #, lang='en' +from . import lang + +def say(text: str) -> None: + """Says a plain text using Google TTS.""" + tts = gtts.gTTS(text=text, lang=lang.detect(text)[0]) #, lang='en' filename = 'tts.temp.mp3' tts.save(filename) + playsound.playsound(filename) os.remove(filename)