-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdummy_ws_requests.py
62 lines (47 loc) · 1.64 KB
/
dummy_ws_requests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import asyncio
import common.log as log
logger = log.setup_logger()
async def dummy_stt_startup():
logger.debug("Starting up STT WS")
await asyncio.sleep(1)
return {"resp":"True"}
async def dummy_tts_startup():
logger.debug("Starting up TTS WS")
await asyncio.sleep(1)
return {"resp":"True"}
async def dummy_sg_startup():
logger.debug("Starting up SG WS")
await asyncio.sleep(1)
return {"resp":"True"}
async def dummy_stt_start(microphone_name):
logger.debug(f"Starting to transcribe w/ {microphone_name}")
await asyncio.sleep(1)
return {"resp":"True"}
async def dummy_stt_stop():
from random import randrange
texts = ["A warm guitar sound with lots of vibratto",
"long decay guitar sound... that's also bright",
"weird guitar sound with a twang at the end",
"something else too"]
logger.debug("Stopping STT and extracting text")
await asyncio.sleep(5)
return {"resp": texts[randrange(3)]}
async def dummy_tts_transcribe(text):
logger.debug("Starting TTS Transcribe")
await asyncio.sleep(2)
outputs = {
'velocity': 75,
'pitch': 60,
'source': 'acoustic',
'qualities': ['bright', 'percussive'],
'latent_sample': [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
}
return {"resp": outputs}
async def dummy_sg_generate(inputs):
logger.debug("Starting sound generation")
await asyncio.sleep(2)
return {"resp":[1, 2, 3, 4]}
async def dummy_preprocessing():
logger.debug("Doing some preprocessing")
await asyncio.sleep(5)
return {"resp":"True"}