mirror of
https://github.com/onyx-and-iris/vban-cmd-python.git
synced 2026-01-24 17:27:48 +00:00
implement audibility knobs (inc comp, gate, denoiser)
This commit is contained in:
parent
14f79d1388
commit
45ffed9f63
@ -217,10 +217,11 @@ class VbanRtPacketNBS0(VbanRtPacket):
|
||||
)
|
||||
|
||||
|
||||
class EqGains(NamedTuple):
|
||||
bass: float
|
||||
mid: float
|
||||
treble: float
|
||||
class Audibility(NamedTuple):
|
||||
knob: float
|
||||
comp: float
|
||||
gate: float
|
||||
denoiser: float
|
||||
|
||||
|
||||
class Positions(NamedTuple):
|
||||
@ -232,6 +233,20 @@ class Positions(NamedTuple):
|
||||
fx2: float
|
||||
|
||||
|
||||
class EqGains(NamedTuple):
|
||||
bass: float
|
||||
mid: float
|
||||
treble: float
|
||||
|
||||
|
||||
class ParametricEQSettings(NamedTuple):
|
||||
eq_on: bool
|
||||
eq_type: int
|
||||
eq_gain: float
|
||||
eq_freq: float
|
||||
eq_q: float
|
||||
|
||||
|
||||
class Sends(NamedTuple):
|
||||
reverb: float
|
||||
delay: float
|
||||
@ -239,6 +254,40 @@ class Sends(NamedTuple):
|
||||
fx2: float
|
||||
|
||||
|
||||
class CompressorSettings(NamedTuple):
|
||||
gain_in: float
|
||||
attack_ms: float
|
||||
release_ms: float
|
||||
n_knee: float
|
||||
comprate: float
|
||||
threshold: float
|
||||
c_enabled: bool
|
||||
c_auto: bool
|
||||
gain_out: float
|
||||
|
||||
|
||||
class GateSettings(NamedTuple):
|
||||
dBThreshold_in: float
|
||||
dBDamping_max: float
|
||||
BP_Sidechain: bool
|
||||
attack_ms: float
|
||||
hold_ms: float
|
||||
release_ms: float
|
||||
|
||||
|
||||
class DenoiserSettings(NamedTuple):
|
||||
threshold: float
|
||||
|
||||
|
||||
class PitchSettings(NamedTuple):
|
||||
enabled: bool
|
||||
dry_wet: float
|
||||
value: float
|
||||
formant_lo: float
|
||||
formant_med: float
|
||||
formant_high: float
|
||||
|
||||
|
||||
@dataclass
|
||||
class VbanVMParamStrip:
|
||||
"""Represents the VBAN_VMPARAMSTRIP_PACKET structure"""
|
||||
@ -356,16 +405,12 @@ class VbanVMParamStrip:
|
||||
return int.from_bytes(self._mode, 'little')
|
||||
|
||||
@property
|
||||
def eqgains(self) -> EqGains:
|
||||
return EqGains(
|
||||
*[
|
||||
round(
|
||||
int.from_bytes(getattr(self, f'_EQgain{i}'), 'little', signed=True)
|
||||
* 0.01,
|
||||
2,
|
||||
)
|
||||
for i in range(1, 4)
|
||||
]
|
||||
def audibility(self) -> Audibility:
|
||||
return Audibility(
|
||||
round(int.from_bytes(self._audibility, 'little', signed=True) * 0.01, 2),
|
||||
round(int.from_bytes(self._audibility_c, 'little', signed=True) * 0.01, 2),
|
||||
round(int.from_bytes(self._audibility_g, 'little', signed=True) * 0.01, 2),
|
||||
round(int.from_bytes(self._audibility_d, 'little', signed=True) * 0.01, 2),
|
||||
)
|
||||
|
||||
@property
|
||||
@ -379,6 +424,19 @@ class VbanVMParamStrip:
|
||||
round(int.from_bytes(self._posMod_y, 'little', signed=True) * 0.01, 2),
|
||||
)
|
||||
|
||||
@property
|
||||
def eqgains(self) -> EqGains:
|
||||
return EqGains(
|
||||
*[
|
||||
round(
|
||||
int.from_bytes(getattr(self, f'_EQgain{i}'), 'little', signed=True)
|
||||
* 0.01,
|
||||
2,
|
||||
)
|
||||
for i in range(1, 4)
|
||||
]
|
||||
)
|
||||
|
||||
@property
|
||||
def sends(self) -> Sends:
|
||||
return Sends(
|
||||
|
||||
@ -76,12 +76,14 @@ class PhysicalStrip(Strip):
|
||||
return f'{type(self).__name__}{self.index}'
|
||||
|
||||
@property
|
||||
def device(self):
|
||||
return
|
||||
def audibility(self) -> float:
|
||||
if self.public_packets[NBS.one] is None:
|
||||
return 0.0
|
||||
return self.public_packets[NBS.one].strips[self.index].audibility.knob
|
||||
|
||||
@property
|
||||
def sr(self):
|
||||
return
|
||||
@audibility.setter
|
||||
def audibility(self, val: float):
|
||||
self.setter('audibility', val)
|
||||
|
||||
|
||||
class StripComp(IRemote):
|
||||
@ -91,7 +93,9 @@ class StripComp(IRemote):
|
||||
|
||||
@property
|
||||
def knob(self) -> float:
|
||||
return
|
||||
if self.public_packets[NBS.one] is None:
|
||||
return 0.0
|
||||
return self.public_packets[NBS.one].strips[self.index].audibility.comp
|
||||
|
||||
@knob.setter
|
||||
def knob(self, val: float):
|
||||
@ -169,7 +173,9 @@ class StripGate(IRemote):
|
||||
|
||||
@property
|
||||
def knob(self) -> float:
|
||||
return
|
||||
if self.public_packets[NBS.one] is None:
|
||||
return 0.0
|
||||
return self.public_packets[NBS.one].strips[self.index].audibility.gate
|
||||
|
||||
@knob.setter
|
||||
def knob(self, val: float):
|
||||
@ -231,7 +237,9 @@ class StripDenoiser(IRemote):
|
||||
|
||||
@property
|
||||
def knob(self) -> float:
|
||||
return
|
||||
if self.public_packets[NBS.one] is None:
|
||||
return 0.0
|
||||
return self.public_packets[NBS.one].strips[self.index].audibility.denoiser
|
||||
|
||||
@knob.setter
|
||||
def knob(self, val: float):
|
||||
|
||||
@ -39,9 +39,6 @@ class Subscriber(threading.Thread):
|
||||
sub_packet, (self._remote.ip, self._remote.port)
|
||||
)
|
||||
self._framecounter = bump_framecounter(self._framecounter)
|
||||
self.logger.debug(
|
||||
f'sent subscription for NBS {nbs.name} to {self._remote.ip}:{self._remote.port}'
|
||||
)
|
||||
|
||||
self.wait_until_stopped(10)
|
||||
except socket.gaierror as e:
|
||||
@ -102,27 +99,11 @@ class Producer(threading.Thread):
|
||||
|
||||
match response_header.format_nbs:
|
||||
case NBS.zero:
|
||||
"""
|
||||
self.logger.debug(
|
||||
'Received NB0 RTP Packet from %s, Size: %d bytes',
|
||||
addr,
|
||||
len(data),
|
||||
)
|
||||
"""
|
||||
|
||||
return VbanRtPacketNBS0.from_bytes(
|
||||
nbs=NBS.zero, kind=self._remote.kind, data=data
|
||||
)
|
||||
|
||||
case NBS.one:
|
||||
"""
|
||||
self.logger.debug(
|
||||
'Received NB1 RTP Packet from %s, Size: %d bytes',
|
||||
addr,
|
||||
len(data),
|
||||
)
|
||||
"""
|
||||
|
||||
return VbanRtPacketNBS1.from_bytes(
|
||||
nbs=NBS.one, kind=self._remote.kind, data=data
|
||||
)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user