add software gain boost parameter for input signal amplification

This commit is contained in:
2026-02-12 13:30:07 +01:00
parent f2382470d8
commit d6230e7522
5 changed files with 35 additions and 1 deletions

View File

@@ -198,6 +198,7 @@ else:
# Analog gain control (only for Analog mode, placed below start button)
analog_gain_value = 50 # default
software_boost_db = 0 # default
if audio_mode == "Analog":
saved_analog_gain = saved_settings.get('analog_gain', 50)
analog_gain_value = st.slider(
@@ -209,6 +210,16 @@ if audio_mode == "Analog":
disabled=is_streaming,
help="ADC gain level for both analog inputs (10-60%). Default is 50%."
)
saved_boost = saved_settings.get('software_boost_db', 0)
software_boost_db = st.slider(
"Software Boost (dB)",
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."
)
# Placeholder for validation errors (will be filled in later)
validation_error_placeholder = st.empty()
@@ -617,6 +628,7 @@ else:
'presentation_delay_ms': presentation_delay_ms2,
'qos_preset': qos_preset2,
'analog_gain': analog_gain_value,
'software_boost_db': software_boost_db,
}
radio1_cfg = {
@@ -633,6 +645,7 @@ else:
'qos_preset': qos_preset1,
'stereo_mode': stereo_enabled,
'analog_gain': analog_gain_value,
'software_boost_db': software_boost_db,
}
if audio_mode == "Network - Dante":
@@ -1529,6 +1542,7 @@ 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)),
)
],
)

View File

@@ -493,6 +493,7 @@ async def init_radio(transport: str, conf: auracast_config.AuracastConfigGroup,
'assisted_listening_stream': getattr(conf, 'assisted_listening_stream', False),
'analog_stereo_mode': getattr(conf.bigs[0], 'analog_stereo_mode', False) if conf.bigs else False,
'analog_gain': getattr(conf, 'analog_gain', 50),
'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],
@@ -736,6 +737,7 @@ 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(
@@ -890,6 +892,7 @@ 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(