Removes boost.
This commit is contained in:
@@ -55,7 +55,6 @@ class AuracastBigConfig(BaseModel):
|
||||
precode_wav: bool = False
|
||||
iso_que_len: int = 64
|
||||
num_bis: int = 1 # 1 = mono (FRONT_LEFT), 2 = stereo (FRONT_LEFT + FRONT_RIGHT)
|
||||
input_gain_db: float = 0.0 # Software gain boost in dB applied before LC3 encoding (0 = off, max 20)
|
||||
|
||||
class AuracastBigConfigDeu(AuracastBigConfig):
|
||||
id: int = 12
|
||||
|
||||
@@ -862,13 +862,6 @@ class Streamer():
|
||||
big['encoder'] = encoders[0]
|
||||
big['precoded'] = False
|
||||
|
||||
# Pre-compute software gain multiplier from dB config (0 dB = 1.0 = no change)
|
||||
gain_db = getattr(big_config[i], 'input_gain_db', 0.0)
|
||||
gain_db = max(0.0, min(20.0, float(gain_db)))
|
||||
big['_gain_linear'] = 10.0 ** (gain_db / 20.0) if gain_db > 0 else 0.0
|
||||
if big['_gain_linear'] > 0.0:
|
||||
logging.info("Software gain for BIG %d: +%.1f dB (linear %.3f)", i, gain_db, big['_gain_linear'])
|
||||
|
||||
logging.info("Streaming audio...")
|
||||
bigs = self.bigs
|
||||
self.is_streaming = True
|
||||
@@ -916,14 +909,6 @@ class Streamer():
|
||||
stream_finished[i] = True
|
||||
continue
|
||||
|
||||
# Apply software gain boost if configured (> 0 dB)
|
||||
gain_lin = big.get('_gain_linear', 0.0)
|
||||
if gain_lin > 0.0:
|
||||
pcm_arr = np.frombuffer(pcm_frame, dtype=np.int16).astype(np.float32)
|
||||
pcm_arr *= gain_lin
|
||||
np.clip(pcm_arr, -32768, 32767, out=pcm_arr)
|
||||
pcm_frame = pcm_arr.astype(np.int16).tobytes()
|
||||
|
||||
# Compute RMS audio level (normalized 0.0-1.0) for level monitoring
|
||||
pcm_samples = np.frombuffer(pcm_frame, dtype=np.int16).astype(np.float32)
|
||||
rms = np.sqrt(np.mean(pcm_samples ** 2)) / 32768.0 if len(pcm_samples) > 0 else 0.0
|
||||
|
||||
@@ -199,7 +199,6 @@ else:
|
||||
|
||||
# Analog gain control (only for Analog mode, placed below start button)
|
||||
analog_gain_db = 0 # default (dB)
|
||||
software_boost_db = 0 # default
|
||||
if audio_mode == "Analog":
|
||||
if '_analog_gain_db' not in st.session_state:
|
||||
saved_analog_gain_db = saved_settings.get('analog_gain_db_left', 0)
|
||||
@@ -226,16 +225,6 @@ if audio_mode == "Analog":
|
||||
except Exception:
|
||||
pass
|
||||
st.session_state['_prev_analog_gain_db'] = analog_gain_db
|
||||
saved_boost = saved_settings.get('software_boost_db', 0)
|
||||
software_boost_db = st.slider(
|
||||
"Boost",
|
||||
min_value=0,
|
||||
max_value=20,
|
||||
value=min(int(saved_boost), 20),
|
||||
step=1,
|
||||
disabled=is_streaming,
|
||||
help="Digital gain boost applied before encoding (0-20 dB). Use this when the line-level signal is too quiet even at max ADC gain. Higher values may cause clipping on loud signals."
|
||||
)
|
||||
|
||||
# Audio level monitor (checkbox, not persisted across reloads)
|
||||
show_level_monitor = st.checkbox("Audio level monitor", value=False, disabled=not is_streaming,
|
||||
@@ -695,7 +684,6 @@ else:
|
||||
'qos_preset': qos_preset2,
|
||||
'analog_gain_db_left': analog_gain_db,
|
||||
'analog_gain_db_right': analog_gain_db,
|
||||
'software_boost_db': software_boost_db,
|
||||
}
|
||||
|
||||
radio1_cfg = {
|
||||
@@ -713,7 +701,6 @@ else:
|
||||
'stereo_mode': stereo_enabled,
|
||||
'analog_gain_db_left': analog_gain_db,
|
||||
'analog_gain_db_right': analog_gain_db,
|
||||
'software_boost_db': software_boost_db,
|
||||
}
|
||||
|
||||
if audio_mode == "Network - Dante":
|
||||
@@ -1611,7 +1598,6 @@ if start_stream:
|
||||
sampling_frequency=q['rate'],
|
||||
octets_per_frame=q['octets'],
|
||||
num_bis=channels, # 1=mono, 2=stereo - this determines the behavior
|
||||
input_gain_db=float(cfg.get('software_boost_db', 0)),
|
||||
)
|
||||
],
|
||||
)
|
||||
|
||||
@@ -530,7 +530,6 @@ async def init_radio(transport: str, conf: auracast_config.AuracastConfigGroup,
|
||||
'analog_stereo_mode': getattr(conf.bigs[0], 'analog_stereo_mode', False) if conf.bigs else False,
|
||||
'analog_gain_db_left': getattr(conf, 'analog_gain_db_left', 0.0),
|
||||
'analog_gain_db_right': getattr(conf, 'analog_gain_db_right', 0.0),
|
||||
'software_boost_db': getattr(conf.bigs[0], 'input_gain_db', 0.0) if conf.bigs else 0.0,
|
||||
'stream_password': (conf.bigs[0].code if conf.bigs and getattr(conf.bigs[0], 'code', None) else None),
|
||||
'big_ids': [getattr(big, 'id', DEFAULT_BIG_ID) for big in conf.bigs],
|
||||
'big_random_addresses': [getattr(big, 'random_address', DEFAULT_RANDOM_ADDRESS) for big in conf.bigs],
|
||||
@@ -810,7 +809,6 @@ async def _autostart_from_settings():
|
||||
iso_que_len=1,
|
||||
sampling_frequency=rate,
|
||||
octets_per_frame=octets,
|
||||
input_gain_db=float(settings.get('software_boost_db', 0)),
|
||||
)
|
||||
]
|
||||
conf = auracast_config.AuracastConfigGroup(
|
||||
@@ -966,7 +964,6 @@ async def _autostart_from_settings():
|
||||
iso_que_len=1,
|
||||
sampling_frequency=rate,
|
||||
octets_per_frame=octets,
|
||||
input_gain_db=float(settings.get('software_boost_db', 0)),
|
||||
)
|
||||
]
|
||||
conf = auracast_config.AuracastConfigGroup(
|
||||
|
||||
Reference in New Issue
Block a user