moving forward
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
from osc4py3.as_eventloop import *
|
||||
from osc4py3 import oscbuildparse
|
||||
|
||||
class OscBroadcaster:
|
||||
|
||||
def __init__(self, name: str, host: str, port: str, command_channel: str):
|
||||
self.name = name
|
||||
self.host = host
|
||||
self.port = port
|
||||
self.cmd = command_channel
|
||||
osc_udp_client(self.host, self.port, self.name)
|
||||
|
||||
def utterance(self, utterance: str, channel: str):
|
||||
msg = oscbuildparse.OSCMessage(channel, None, [utterance])
|
||||
osc_send(msg, self.name)
|
||||
osc_process()
|
||||
|
||||
def command(self, command: str):
|
||||
msg = oscbuildparse.OSCMessage(self.cmd, None, [command])
|
||||
osc_send(msg, self.name)
|
||||
osc_process()
|
||||
|
||||
@staticmethod
|
||||
def start_osc():
|
||||
osc_startup()
|
||||
|
||||
@staticmethod
|
||||
def terminate_osc():
|
||||
osc_terminate()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+30
-1
@@ -1,4 +1,4 @@
|
||||
import string
|
||||
import string, regex
|
||||
|
||||
def clean(text: str) -> str:
|
||||
|
||||
@@ -17,3 +17,32 @@ def clean(text: str) -> str:
|
||||
def format(text: str) -> str:
|
||||
|
||||
return text.replace('\r\n', '\n').replace('\n\n', '\n')
|
||||
|
||||
def fragments(utterance: str):
|
||||
frags = []
|
||||
sentences = utterance.splitlines()
|
||||
|
||||
PUNCT_RE = regex.compile(r'(\p{Punctuation})')
|
||||
|
||||
for s in sentences:
|
||||
sf = PUNCT_RE.split(s)
|
||||
cum = ""
|
||||
for k in sf:
|
||||
if len(k) < 1:
|
||||
continue
|
||||
elif len(k) > 1:
|
||||
cum += k
|
||||
elif k not in string.punctuation:
|
||||
cum += k
|
||||
else:
|
||||
cum += k
|
||||
frags.append(cum)
|
||||
cum = ""
|
||||
cum += '\n'
|
||||
frags.append(cum)
|
||||
|
||||
return frags
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from aitextgen import aitextgen
|
||||
import utterance.utils
|
||||
import regex, string
|
||||
|
||||
class Voice:
|
||||
|
||||
@@ -16,3 +17,17 @@ class Voice:
|
||||
|
||||
def utter_one(self, temp: int = None, lenght: float = None) -> str:
|
||||
return self.utter_n(n=1, temp=temp, lenght=lenght)[0]
|
||||
|
||||
def set_channel(self, root: str, endpoint: str):
|
||||
self.channel = root + endpoint
|
||||
|
||||
def channel(self):
|
||||
return self.channel
|
||||
|
||||
def fragments(self, utt: str):
|
||||
self.utterance = utt
|
||||
self.utterance_fragments = utterance.utils.fragments(utt)
|
||||
return self.utterance_fragments
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user