mirror of
https://github.com/Project-Babble/ProjectBabble.git
synced 2026-11-21 01:21:17 -08:00
fix osc location prefix, cleanup
This commit is contained in:
1 parent
4fb705048e
commit
bf2d1fc12b
7 files changed
+13
-256
No files matched your search
@@ -1,182 +0,0 @@
|
||||
{
|
||||
"cheekPuffLeft": {
|
||||
"min": 0.1,
|
||||
"max": 1.0
|
||||
},
|
||||
"cheekPuffRight": {
|
||||
"min": 0.1,
|
||||
"max": 1.0
|
||||
},
|
||||
"cheekSuckLeft": {
|
||||
"min": 0.1,
|
||||
"max": 1.0
|
||||
},
|
||||
"cheekSuckRight": {
|
||||
"min": 0.1,
|
||||
"max": 1.0
|
||||
},
|
||||
"jawOpen": {
|
||||
"min": 0.0,
|
||||
"max": 1.0
|
||||
},
|
||||
"jawForward": {
|
||||
"min": 0.0,
|
||||
"max": 1.0
|
||||
},
|
||||
"jawLeft": {
|
||||
"min": 0.0,
|
||||
"max": 1.0
|
||||
},
|
||||
"jawRight": {
|
||||
"min": 0.0,
|
||||
"max": 1.0
|
||||
},
|
||||
"noseSneerLeft": {
|
||||
"min": 0.0,
|
||||
"max": 1.0
|
||||
},
|
||||
"noseSneerRight": {
|
||||
"min": 0.0,
|
||||
"max": 1.0
|
||||
},
|
||||
"mouthFunnel": {
|
||||
"min": 0.05,
|
||||
"max": 1.0
|
||||
},
|
||||
"mouthPucker": {
|
||||
"min": 0.0,
|
||||
"max": 1.0
|
||||
},
|
||||
"mouthLeft": {
|
||||
"min": 0.05,
|
||||
"max": 1.0
|
||||
},
|
||||
"mouthRight": {
|
||||
"min": 0.05,
|
||||
"max": 1.0
|
||||
},
|
||||
"mouthRollUpper": {
|
||||
"min": 0.0,
|
||||
"max": 1.0
|
||||
},
|
||||
"mouthRollLower": {
|
||||
"min": 0.0,
|
||||
"max": 1.0
|
||||
},
|
||||
"mouthShrugUpper": {
|
||||
"min": 0.0,
|
||||
"max": 1.0
|
||||
},
|
||||
"mouthShrugLower": {
|
||||
"min": 0.0,
|
||||
"max": 1.0
|
||||
},
|
||||
"mouthClose": {
|
||||
"min": 0.0,
|
||||
"max": 1.0
|
||||
},
|
||||
"mouthSmileLeft": {
|
||||
"min": 0.0,
|
||||
"max": 1.0
|
||||
},
|
||||
"mouthSmileRight": {
|
||||
"min": 0.0,
|
||||
"max": 1.0
|
||||
},
|
||||
"mouthFrownLeft": {
|
||||
"min": 0.0,
|
||||
"max": 1.0
|
||||
},
|
||||
"mouthFrownRight": {
|
||||
"min": 0.0,
|
||||
"max": 1.0
|
||||
},
|
||||
"mouthDimpleLeft": {
|
||||
"min": 0.0,
|
||||
"max": 1.0
|
||||
},
|
||||
"mouthDimpleRight": {
|
||||
"min": 0.0,
|
||||
"max": 1.0
|
||||
},
|
||||
"mouthUpperUpLeft": {
|
||||
"min": 0.02,
|
||||
"max": 0.8
|
||||
},
|
||||
"mouthUpperUpRight": {
|
||||
"min": 0.02,
|
||||
"max": 0.8
|
||||
},
|
||||
"mouthLowerDownLeft": {
|
||||
"min": 0.02,
|
||||
"max": 0.8
|
||||
},
|
||||
"mouthLowerDownRight": {
|
||||
"min": 0.02,
|
||||
"max": 0.8
|
||||
},
|
||||
"mouthPressLeft": {
|
||||
"min": 0.0,
|
||||
"max": 1.0
|
||||
},
|
||||
"mouthPressRight": {
|
||||
"min": 0.0,
|
||||
"max": 1.0
|
||||
},
|
||||
"mouthStretchLeft": {
|
||||
"min": 0.05,
|
||||
"max": 1.0
|
||||
},
|
||||
"mouthStretchRight": {
|
||||
"min": 0.05,
|
||||
"max": 1.0
|
||||
},
|
||||
"tongueOut": {
|
||||
"min": 0.05,
|
||||
"max": 1.0
|
||||
},
|
||||
"tongueUp": {
|
||||
"min": 0.05,
|
||||
"max": 1.0
|
||||
},
|
||||
"tongueDown": {
|
||||
"min": 0.05,
|
||||
"max": 1.0
|
||||
},
|
||||
"tongueLeft": {
|
||||
"min": 0.05,
|
||||
"max": 1.0
|
||||
},
|
||||
"tongueRight": {
|
||||
"min": 0.05,
|
||||
"max": 1.0
|
||||
},
|
||||
"tongueRoll": {
|
||||
"min": 0.05,
|
||||
"max": 1.0
|
||||
},
|
||||
"tongueBendDown": {
|
||||
"min": 0.05,
|
||||
"max": 1.0
|
||||
},
|
||||
"tongueCurlUp": {
|
||||
"min": 0.05,
|
||||
"max": 1.0
|
||||
},
|
||||
"tongueSquish": {
|
||||
"min": 0.05,
|
||||
"max": 1.0
|
||||
},
|
||||
"tongueFlat": {
|
||||
"min": 0.05,
|
||||
"max": 1.0
|
||||
},
|
||||
"tongueTwistLeft": {
|
||||
"min": 0.05,
|
||||
"max": 1.0
|
||||
},
|
||||
"tongueTwistRight": {
|
||||
"min": 0.05,
|
||||
"max": 1.0
|
||||
}
|
||||
}
|
||||
+1
-3
@@ -19,6 +19,7 @@ class BabbleCameraConfig(BaseModel):
|
||||
use_calibration: bool = False
|
||||
gui_vertical_flip: bool = False
|
||||
gui_horizontal_flip: bool = False
|
||||
|
||||
class BabbleSettingsConfig(BaseModel):
|
||||
gui_min_cutoff: str = "15.5004"
|
||||
gui_speed_coefficient: str = "0.62"
|
||||
@@ -33,9 +34,6 @@ class BabbleSettingsConfig(BaseModel):
|
||||
gui_model_file: str = 'Models/EFV2300K45E100P2.onnx'
|
||||
gui_use_gpu: bool = False
|
||||
calib_array: str = None
|
||||
# gui_vertical_flip: bool = False
|
||||
# gui_horizontal_flip: bool = False
|
||||
|
||||
|
||||
class BabbleConfig(BaseModel):
|
||||
version: int = 1
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import PySimpleGUI as sg
|
||||
|
||||
from config import BabbleSettingsConfig
|
||||
from osc import Tab
|
||||
from queue import Queue
|
||||
@@ -196,6 +195,11 @@ class SettingsWidget:
|
||||
self.config.gui_ROSC = values[self.gui_ROSC]
|
||||
changed = True
|
||||
|
||||
if self.config.gui_osc_location != values[self.gui_osc_location]:
|
||||
self.config.gui_osc_location = values[self.gui_osc_location]
|
||||
changed = True
|
||||
|
||||
|
||||
if changed:
|
||||
self.main_config.save()
|
||||
self.osc_queue.put((Tab.SETTINGS))
|
||||
+3
-7
@@ -1,8 +1,5 @@
|
||||
|
||||
from pythonosc import udp_client
|
||||
from pythonosc import osc_server
|
||||
from pythonosc import dispatcher
|
||||
from utils.misc_utils import PlaySound,SND_FILENAME,SND_ASYNC
|
||||
from pythonosc import udp_client, osc_server, dispatcher
|
||||
from utils.misc_utils import PlaySound, SND_FILENAME, SND_ASYNC
|
||||
import queue
|
||||
import threading
|
||||
from enum import IntEnum
|
||||
@@ -17,6 +14,7 @@ class Tab(IntEnum):
|
||||
|
||||
def output_osc(array, self):
|
||||
location = self.config.gui_osc_location
|
||||
print(self.config.gui_osc_location)
|
||||
multi = self.config.gui_multiply
|
||||
self.client.send_message(location + "/cheekPuffLeft", array[0] * multi)
|
||||
self.client.send_message(location + "/cheekPuffRight", array[1] * multi)
|
||||
@@ -75,8 +73,6 @@ class VRChatOSC:
|
||||
self.cam = Tab.CAM
|
||||
|
||||
def run(self):
|
||||
start = time.time()
|
||||
last_blink = time.time()
|
||||
while True:
|
||||
if self.cancellation_event.is_set():
|
||||
print("\033[94m[INFO] Exiting OSC Queue\033[0m")
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
import numpy as np
|
||||
|
||||
from enum import IntEnum
|
||||
from utils.misc_utils import PlaySound, SND_FILENAME, SND_ASYNC
|
||||
|
||||
class CamId(IntEnum):
|
||||
RIGHT = 0
|
||||
LEFT = 1
|
||||
BOTH = 2
|
||||
SETTINGS = 3
|
||||
|
||||
CAM = 0
|
||||
SETTINGS = 1
|
||||
|
||||
class cal():
|
||||
def cal_osc(self, array):
|
||||
@@ -43,19 +39,12 @@ class cal():
|
||||
print("[INFO] Calibration completed.")
|
||||
|
||||
PlaySound('Audio/completed.wav', SND_FILENAME | SND_ASYNC)
|
||||
if self.calibration_frame_counter == 10:
|
||||
|
||||
self.calibration_frame_counter -= 1
|
||||
elif self.calibration_frame_counter != None:
|
||||
|
||||
self.val_list.append(array)
|
||||
|
||||
|
||||
# self.calibrate_config = np.vstack((self.calibrate_config, array.T))
|
||||
# np.append(self.calibrate_config, array.reshape(-1, 1), axis=1)
|
||||
|
||||
self.calibration_frame_counter -= 1
|
||||
# print(self.settings.calib_array)
|
||||
|
||||
if self.settings.calib_array is not None and self.config.use_calibration:
|
||||
self.min_max_array = np.fromstring(self.settings.calib_array.replace('[', '').replace(']', ''), sep=',')
|
||||
self.min_max_array = self.min_max_array.reshape((2, 45))
|
||||
@@ -73,5 +62,4 @@ class cal():
|
||||
calibrated_array[i] = calibrated_value
|
||||
array = calibrated_array
|
||||
|
||||
|
||||
return array
|
||||
Whitespace-only changes.
@@ -10,51 +10,4 @@ if is_nt:
|
||||
import winsound
|
||||
PlaySound = winsound.PlaySound
|
||||
SND_FILENAME = winsound.SND_FILENAME
|
||||
SND_ASYNC = winsound.SND_ASYNC
|
||||
|
||||
def clamp(x, low, high):
|
||||
return max(low, min(x, high))
|
||||
|
||||
|
||||
def lst_median(lst, ordered=False):
|
||||
# https://github.com/emilianavt/OpenSeeFace/blob/6f24efc4f58eb7cca47ec2146d934eabcc207e46/remedian.py
|
||||
assert lst, "median needs a non-empty list"
|
||||
n = len(lst)
|
||||
p = q = n // 2
|
||||
if n < 3:
|
||||
p, q = 0, n - 1
|
||||
else:
|
||||
lst = lst if ordered else sorted(lst)
|
||||
if not n % 2: # for even-length lists, use mean of mid 2 nums
|
||||
q = p - 1
|
||||
return lst[p] if p == q else (lst[p] + lst[q]) / 2
|
||||
|
||||
|
||||
class FastMedian:
|
||||
# https://github.com/emilianavt/OpenSeeFace/blob/6f24efc4f58eb7cca47ec2146d934eabcc207e46/remedian.py
|
||||
# Initialization
|
||||
def __init__(self, inits: typing.Optional[typing.Sequence] = [], k=64): # after some experimentation, 64 works ok
|
||||
self.all, self.k = [], k
|
||||
self.more, self.__median = None, None
|
||||
if inits is not None:
|
||||
[self + x for x in inits]
|
||||
|
||||
# When full, push the median of current values to next list, then reset.
|
||||
def __add__(self, x):
|
||||
self.__median = None
|
||||
self.all.append(x) # It would be faster to pre-allocate an array and assign it by index.
|
||||
if len(self.all) == self.k:
|
||||
self.more = self.more or FastMedian(k=self.k)
|
||||
self.more + self.__medianPrim(self.all)
|
||||
# It's going to be slower because of the re-allocation.
|
||||
self.all = [] # reset
|
||||
|
||||
# If there is a next list, ask its median. Else, work it out locally.
|
||||
def median(self):
|
||||
return self.more.median() if self.more else self.__medianPrim(self.all)
|
||||
|
||||
# Only recompute median if we do not know it already.
|
||||
def __medianPrim(self, all):
|
||||
if self.__median is None:
|
||||
self.__median = lst_median(all, ordered=False)
|
||||
return self.__median
|
||||
SND_ASYNC = winsound.SND_ASYNC
|
||||
Reference in new issue
Block a user