From 0512fac7108c585cce81713d21072938c54f7731 Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Sun, 18 Jan 2026 15:16:48 +0000 Subject: [PATCH] implement parametric eq --- vban_cmd/packet.py | 73 ++++++++++++++++++++++++++++++++++++++++++++-- vban_cmd/strip.py | 42 +++++++++++++++++--------- 2 files changed, 100 insertions(+), 15 deletions(-) diff --git a/vban_cmd/packet.py b/vban_cmd/packet.py index 62dbaff..c90737d 100644 --- a/vban_cmd/packet.py +++ b/vban_cmd/packet.py @@ -263,7 +263,7 @@ class CompressorSettings(NamedTuple): comprate: float threshold: float c_enabled: bool - c_auto: bool + makeup: bool gain_out: float @@ -439,7 +439,7 @@ class VbanVMParamStrip: ) @property - def parametric_eq_settings(self) -> tuple[ParametricEQSettings, ...]: + def parametric_eq(self) -> tuple[ParametricEQSettings, ...]: return tuple( ParametricEQSettings( on=bool(int.from_bytes(self._PEQ_eqOn[i : i + 1], 'little')), @@ -464,6 +464,75 @@ class VbanVMParamStrip: def karaoke(self) -> int: return int.from_bytes(self._nKaraoke, 'little') + @property + def compressor(self) -> CompressorSettings: + return CompressorSettings( + gain_in=round( + int.from_bytes(self._COMP_gain_in, 'little', signed=True) * 0.01, 2 + ), + attack_ms=round(int.from_bytes(self._COMP_attack_ms, 'little') * 0.1, 2), + release_ms=round(int.from_bytes(self._COMP_release_ms, 'little') * 0.1, 2), + n_knee=round(int.from_bytes(self._COMP_n_knee, 'little') * 0.01, 2), + comprate=round(int.from_bytes(self._COMP_comprate, 'little') * 0.01, 2), + threshold=round( + int.from_bytes(self._COMP_threshold, 'little', signed=True) * 0.01, 2 + ), + c_enabled=bool(int.from_bytes(self._COMP_c_enabled, 'little')), + makeup=bool(int.from_bytes(self._COMP_c_auto, 'little')), + gain_out=round( + int.from_bytes(self._COMP_gain_out, 'little', signed=True) * 0.01, 2 + ), + ) + + @property + def gate(self) -> GateSettings: + return GateSettings( + dBThreshold_in=round( + int.from_bytes(self._GATE_dBThreshold_in, 'little', signed=True) * 0.01, + 2, + ), + dBDamping_max=round( + int.from_bytes(self._GATE_dBDamping_max, 'little', signed=True) * 0.01, + 2, + ), + BP_Sidechain=round( + int.from_bytes(self._GATE_BP_Sidechain, 'little') * 0.1, 2 + ), + attack_ms=round(int.from_bytes(self._GATE_attack_ms, 'little') * 0.1, 2), + hold_ms=round(int.from_bytes(self._GATE_hold_ms, 'little') * 0.1, 2), + release_ms=round(int.from_bytes(self._GATE_release_ms, 'little') * 0.1, 2), + ) + + @property + def denoiser(self) -> DenoiserSettings: + return DenoiserSettings( + threshold=round( + int.from_bytes(self._DenoiserThreshold, 'little', signed=True) * 0.01, 2 + ) + ) + + @property + def pitch(self) -> PitchSettings: + return PitchSettings( + enabled=bool(int.from_bytes(self._PitchEnabled, 'little')), + dry_wet=round( + int.from_bytes(self._Pitch_DryWet, 'little', signed=True) * 0.01, 2 + ), + value=round( + int.from_bytes(self._Pitch_Value, 'little', signed=True) * 0.01, 2 + ), + formant_lo=round( + int.from_bytes(self._Pitch_formant_lo, 'little', signed=True) * 0.01, 2 + ), + formant_med=round( + int.from_bytes(self._Pitch_formant_med, 'little', signed=True) * 0.01, 2 + ), + formant_high=round( + int.from_bytes(self._Pitch_formant_high, 'little', signed=True) * 0.01, + 2, + ), + ) + @dataclass class VbanRtPacketNBS1(VbanRtPacket): diff --git a/vban_cmd/strip.py b/vban_cmd/strip.py index d52f127..b96b7a1 100644 --- a/vban_cmd/strip.py +++ b/vban_cmd/strip.py @@ -103,7 +103,9 @@ class StripComp(IRemote): @property def gainin(self) -> float: - return + if self.public_packets[NBS.one] is None: + return 0.0 + return self.public_packets[NBS.one].strips[self.index].compressor.gain_in @gainin.setter def gainin(self, val: float): @@ -111,7 +113,9 @@ class StripComp(IRemote): @property def ratio(self) -> float: - return + if self.public_packets[NBS.one] is None: + return 0.0 + return self.public_packets[NBS.one].strips[self.index].compressor.comprate @ratio.setter def ratio(self, val: float): @@ -119,7 +123,9 @@ class StripComp(IRemote): @property def threshold(self) -> float: - return + if self.public_packets[NBS.one] is None: + return 0.0 + return self.public_packets[NBS.one].strips[self.index].compressor.threshold @threshold.setter def threshold(self, val: float): @@ -127,7 +133,9 @@ class StripComp(IRemote): @property def attack(self) -> float: - return + if self.public_packets[NBS.one] is None: + return 0.0 + return self.public_packets[NBS.one].strips[self.index].compressor.attack_ms @attack.setter def attack(self, val: float): @@ -135,7 +143,9 @@ class StripComp(IRemote): @property def release(self) -> float: - return + if self.public_packets[NBS.one] is None: + return 0.0 + return self.public_packets[NBS.one].strips[self.index].compressor.release_ms @release.setter def release(self, val: float): @@ -143,7 +153,9 @@ class StripComp(IRemote): @property def knee(self) -> float: - return + if self.public_packets[NBS.one] is None: + return 0.0 + return self.public_packets[NBS.one].strips[self.index].compressor.n_knee @knee.setter def knee(self, val: float): @@ -151,7 +163,9 @@ class StripComp(IRemote): @property def gainout(self) -> float: - return + if self.public_packets[NBS.one] is None: + return 0.0 + return self.public_packets[NBS.one].strips[self.index].compressor.gain_out @gainout.setter def gainout(self, val: float): @@ -159,7 +173,9 @@ class StripComp(IRemote): @property def makeup(self) -> bool: - return + if self.public_packets[NBS.one] is None: + return False + return bool(self.public_packets[NBS.one].strips[self.index].compressor.makeup) @makeup.setter def makeup(self, val: bool): @@ -336,7 +352,7 @@ class StripEQChCell(IRemote): return ( self.public_packets[NBS.one] .strips[self.index] - .parametric_eq_settings[self.cell_index] + .parametric_eq[self.cell_index] .on ) @@ -355,7 +371,7 @@ class StripEQChCell(IRemote): return ( self.public_packets[NBS.one] .strips[self.index] - .parametric_eq_settings[self.cell_index] + .parametric_eq[self.cell_index] .type ) @@ -374,7 +390,7 @@ class StripEQChCell(IRemote): return ( self.public_packets[NBS.one] .strips[self.index] - .parametric_eq_settings[self.cell_index] + .parametric_eq[self.cell_index] .freq ) @@ -393,7 +409,7 @@ class StripEQChCell(IRemote): return ( self.public_packets[NBS.one] .strips[self.index] - .parametric_eq_settings[self.cell_index] + .parametric_eq[self.cell_index] .gain ) @@ -412,7 +428,7 @@ class StripEQChCell(IRemote): return ( self.public_packets[NBS.one] .strips[self.index] - .parametric_eq_settings[self.cell_index] + .parametric_eq[self.cell_index] .q )