implement audibility knobs (inc comp, gate, denoiser)

This commit is contained in:
onyx-and-iris 2026-01-18 13:13:05 +00:00
parent 14f79d1388
commit 45ffed9f63
3 changed files with 88 additions and 41 deletions

View File

@ -217,10 +217,11 @@ class VbanRtPacketNBS0(VbanRtPacket):
) )
class EqGains(NamedTuple): class Audibility(NamedTuple):
bass: float knob: float
mid: float comp: float
treble: float gate: float
denoiser: float
class Positions(NamedTuple): class Positions(NamedTuple):
@ -232,6 +233,20 @@ class Positions(NamedTuple):
fx2: float 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): class Sends(NamedTuple):
reverb: float reverb: float
delay: float delay: float
@ -239,6 +254,40 @@ class Sends(NamedTuple):
fx2: float 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 @dataclass
class VbanVMParamStrip: class VbanVMParamStrip:
"""Represents the VBAN_VMPARAMSTRIP_PACKET structure""" """Represents the VBAN_VMPARAMSTRIP_PACKET structure"""
@ -356,16 +405,12 @@ class VbanVMParamStrip:
return int.from_bytes(self._mode, 'little') return int.from_bytes(self._mode, 'little')
@property @property
def eqgains(self) -> EqGains: def audibility(self) -> Audibility:
return EqGains( return Audibility(
*[ round(int.from_bytes(self._audibility, 'little', signed=True) * 0.01, 2),
round( round(int.from_bytes(self._audibility_c, 'little', signed=True) * 0.01, 2),
int.from_bytes(getattr(self, f'_EQgain{i}'), 'little', signed=True) round(int.from_bytes(self._audibility_g, 'little', signed=True) * 0.01, 2),
* 0.01, round(int.from_bytes(self._audibility_d, 'little', signed=True) * 0.01, 2),
2,
)
for i in range(1, 4)
]
) )
@property @property
@ -379,6 +424,19 @@ class VbanVMParamStrip:
round(int.from_bytes(self._posMod_y, 'little', signed=True) * 0.01, 2), 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 @property
def sends(self) -> Sends: def sends(self) -> Sends:
return Sends( return Sends(

View File

@ -76,12 +76,14 @@ class PhysicalStrip(Strip):
return f'{type(self).__name__}{self.index}' return f'{type(self).__name__}{self.index}'
@property @property
def device(self): def audibility(self) -> float:
return if self.public_packets[NBS.one] is None:
return 0.0
return self.public_packets[NBS.one].strips[self.index].audibility.knob
@property @audibility.setter
def sr(self): def audibility(self, val: float):
return self.setter('audibility', val)
class StripComp(IRemote): class StripComp(IRemote):
@ -91,7 +93,9 @@ class StripComp(IRemote):
@property @property
def knob(self) -> float: 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 @knob.setter
def knob(self, val: float): def knob(self, val: float):
@ -169,7 +173,9 @@ class StripGate(IRemote):
@property @property
def knob(self) -> float: 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 @knob.setter
def knob(self, val: float): def knob(self, val: float):
@ -231,7 +237,9 @@ class StripDenoiser(IRemote):
@property @property
def knob(self) -> float: 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 @knob.setter
def knob(self, val: float): def knob(self, val: float):

View File

@ -39,9 +39,6 @@ class Subscriber(threading.Thread):
sub_packet, (self._remote.ip, self._remote.port) sub_packet, (self._remote.ip, self._remote.port)
) )
self._framecounter = bump_framecounter(self._framecounter) 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) self.wait_until_stopped(10)
except socket.gaierror as e: except socket.gaierror as e:
@ -102,27 +99,11 @@ class Producer(threading.Thread):
match response_header.format_nbs: match response_header.format_nbs:
case NBS.zero: case NBS.zero:
"""
self.logger.debug(
'Received NB0 RTP Packet from %s, Size: %d bytes',
addr,
len(data),
)
"""
return VbanRtPacketNBS0.from_bytes( return VbanRtPacketNBS0.from_bytes(
nbs=NBS.zero, kind=self._remote.kind, data=data nbs=NBS.zero, kind=self._remote.kind, data=data
) )
case NBS.one: case NBS.one:
"""
self.logger.debug(
'Received NB1 RTP Packet from %s, Size: %d bytes',
addr,
len(data),
)
"""
return VbanRtPacketNBS1.from_bytes( return VbanRtPacketNBS1.from_bytes(
nbs=NBS.one, kind=self._remote.kind, data=data nbs=NBS.one, kind=self._remote.kind, data=data
) )