Add volume arg to parser (#335)

This PR adds the mic volume to the arg parser and makes the value range from 1-100
This commit is contained in:
aryanhasgithub authored and GitHub committed 2026-06-07 18:15:05 +03:00
1 parent b339f76b7d
commit ec70b3b58d
4 files changed
+10 -4

No files matched your search

+5 -2
View File
@@ -45,10 +45,13 @@ LVA_PULSE_COOKIE="/run/user/${LVA_USER_ID}/pulse/cookie"
### Audio output device (optional):
# AUDIO_OUTPUT_DEVICE="default"
### Mic Gain (optional) passed as an argument to LVA will overide the value in thepreferences file on boot but can be changed at runtime in Home Assistant:
### Microphone volume level (optional):
# MIC_VOLUME="100"
### Mic Gain (optional) passed as an argument to LVA will overide the value in the preferences file on boot but can be changed at runtime in Home Assistant:
# MIC_AUTO_GAIN="0"
### Mic Noise Suppression (optional) passed as an argument to LVA will overide the value in thepreferences file on boot but can be changed at runtime in Home Assistant:
### Mic Noise Suppression (optional) passed as an argument to LVA will overide the value in the preferences file on boot but can be changed at runtime in Home Assistant:
# MIC_NOISE_SUPPRESSION="0"
### Enable thinking sound (optional):
+1 -1
View File
@@ -80,7 +80,7 @@ usage: __main__.py [-h] [--name NAME] [--audio-input-device AUDIO_INPUT_DEVICE]
| `--audio-input-device` | Soundcard name for input device | Autodetected |
| `--audio-input-block-size` | Audio input block size in samples | 1024 |
| `--audio-output-device` | mpv name for output device | Autodetected |
| `--mic-volume` | Control microphone volume | 1.0 |
| `--mic-volume` | Control microphone volume | 100 |
| `--mic-auto-gain` | Add WebRTC Gain to Mic | 0 |
| `--mic-noise-suppression` | Add WebRTC Noise Suppression to Mic | 0 |
| `--wake-word-dir` | Directory with wake word models (.tflite) and configs (.json) | `wakewords/` |
+1 -1
View File
@@ -258,7 +258,7 @@ The following variables can be configured in the `.env` or in the service file:
| `PORT` | `6053` | API server port |
| `AUDIO_INPUT_DEVICE` | Autodetected | Audio input device name |
| `AUDIO_OUTPUT_DEVICE` | Autodetected | Audio output device name |
| `MIC_VOLUME` | Control microphone volume | 1.0 |
| `MIC_VOLUME` | Control microphone volume | 100 |
| `MIC_AUTO_GAIN` | Add WebRTC Gain to Mic | 0 |
| `MIC_NOISE_SUPPRESSION` | Add WebRTC Noise Suppresion to Mic | 0 |
| `ENABLE_THINKING_SOUND` | false | Set to "1" to enable thinking sound |
+3
View File
@@ -71,6 +71,7 @@ async def main() -> None:
action="store_true",
help="List audio output devices and exit",
)
parser.add_argument("--mic-volume", type=int, default=100, choices=list(range(1, 101)), help="Microphone volume level (1 to 100)")
parser.add_argument("--mic-auto-gain", type=int, default=0, choices=list(range(32)))
parser.add_argument("--mic-noise-suppression", type=int, default=0, choices=(0, 1, 2, 3, 4))
parser.add_argument(
@@ -282,6 +283,8 @@ async def main() -> None:
_LOGGER.exception("Extras for webrtc are not installed")
sys.exit(1)
if args.mic_volume > 0.0:
preferences.mic_volume = args.mic_volume
if args.mic_auto_gain > 0:
preferences.mic_auto_gain = args.mic_auto_gain