Skip to content

Commit

Permalink
make call to open tts
Browse files Browse the repository at this point in the history
  • Loading branch information
MrPicklePinosaur committed Jun 10, 2022
1 parent 824eaeb commit cdad108
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
15 changes: 12 additions & 3 deletions api.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
import requests
from config import API_URL
from config import ONIGIRI_URL, OPENTTS_URL

def define_en_get(word):
resp = requests.get(f"{API_URL}/define/en/{word}")
resp = requests.get(f"{ONIGIRI_URL}/define/en/{word}")
if resp:
print(resp.json())


# TODO look into pyaudio or sm to play the response audio

TTS_VOICE = "coqui-tts:en_vctk"
def synthesis_get(text):
# TODO text should be sanitised
resp = requests.get(f"{OPENTTS_URL}/tts?voice={TTS_VOICE}&text={text}")
print(resp)

if __name__ == "__main__":
define_en_get("hello")
# define_en_get("hello")
synthesis_get("hello world")
7 changes: 5 additions & 2 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
CONFIDENCE_THRESHOLD = 0.75 # threshold where intent is accepted

# api
API_URL = "http://localhost:8000"
ONIGIRI_URL = "http://localhost:8000"

# voice stream
# vosk speech recognition
VOSK_URL = "ws://localhost:2700"

# openTTS voice synthesiser
OPENTTS_URL = "http://localhost:5500/api"

0 comments on commit cdad108

Please sign in to comment.