diff --git a/installer/microphone.py b/installer/microphone.py index de94000..25646fb 100644 --- a/installer/microphone.py +++ b/installer/microphone.py @@ -35,7 +35,12 @@ def configure_microphone(settings: Settings) -> None: _LOGGER.warning("Failed to record from microphone %s", device) continue - _LOGGER.debug("Microphone %s got RMS %s (min: %s)", device, device_rms, RECORD_RMS_MIN) + _LOGGER.debug( + "Microphone %s got RMS %s (min: %s)", + device, + device_rms, + RECORD_RMS_MIN, + ) if device_rms < RECORD_RMS_MIN: continue @@ -48,8 +53,10 @@ def configure_microphone(settings: Settings) -> None: settings.mic.device = best_device settings.save() else: - msgbox("Audio was not detected from any microphone.\n" - "If a satellite is currently running, you may need to stop it.") + msgbox( + "Audio was not detected from any microphone.\n" + "If a satellite is currently running, you may need to stop it." + ) elif choice == "list": # arecord -L microphone_device = radiolist( @@ -120,7 +127,9 @@ def _record_proc(device: str) -> Optional[float]: ) audio, stderr = proc.communicate() if proc.returncode != 0: - _LOGGER.error("Error recording from device %s: %s", device, stderr.decode("utf-8")) + _LOGGER.error( + "Error recording from device %s: %s", device, stderr.decode("utf-8") + ) return None # 16-bit mono diff --git a/installer/services.py b/installer/services.py index bca58fc..7d12568 100644 --- a/installer/services.py +++ b/installer/services.py @@ -17,7 +17,7 @@ from .whiptail import error, msgbox, run_with_gauge def stop_services(password: str) -> None: stop_commands = [] - for service in ("satellite", "openwakeword", "porcupine1", "snowboy"): + for service in ("satellite", "wakeword", "event"): service_filename = f"wyoming-{service}.service" service_path = Path("/etc/systemd/system") / service_filename if not service_path.exists(): @@ -83,10 +83,8 @@ def generate_services(settings: Settings) -> None: # Local wake word detection assert settings.wake.system is not None, "Wake word system not set" - wake_word_service = ( - "wyoming-" + WakeWordSystem(settings.wake.system).value.lower() - ) - wake_word_dir = LOCAL_DIR / wake_word_service + wake_word_service = "wyoming-wakeword" + wake_word_dir = LOCAL_DIR / WakeWordSystem(settings.wake.system).value.lower() wake_word_command = [ str(wake_word_dir / "script" / "run"), "--uri", @@ -165,7 +163,7 @@ def generate_services(settings: Settings) -> None: SERVICES_DIR / f"{event_service}.service", "w", encoding="utf-8" ) as service_file: print("[Unit]", file=service_file) - print(f"Description=Event service", file=service_file) + print("Description=Event service", file=service_file) print("", file=service_file) print("[Service]", file=service_file) print("Type=simple", file=service_file) diff --git a/installer/speakers.py b/installer/speakers.py index c0033ad..74135a9 100644 --- a/installer/speakers.py +++ b/installer/speakers.py @@ -53,6 +53,26 @@ def configure_speakers(settings: Settings) -> None: if feedback_sounds is not None: settings.snd.feedback_sounds = feedback_sounds settings.save() + elif choice == "multiplier": + while True: + volume_multiplier = inputbox( + "Volume Multipler (1 = default)", settings.snd.volume_multiplier + ) + if volume_multiplier is None: + break + + try: + volume_multiplier_float = float(volume_multiplier) + except ValueError: + msgbox("Invalid value") + continue + + if volume_multiplier_float > 0: + settings.snd.volume_multiplier = volume_multiplier_float + settings.save() + break + + msgbox("Must be > 0") else: break @@ -66,6 +86,7 @@ def speakers_menu(last_choice: Optional[str]) -> Optional[str]: ("list", "Select From List"), ("manual", "Enter Manually"), ("disable", "Disable Sound"), + ("multipler", "Volume Multipler"), ("feedback", "Toggle Feedback Sounds"), ], selected_item=last_choice, diff --git a/wyoming_satellite/satellite.py b/wyoming_satellite/satellite.py index 5b41f54..209e5d9 100644 --- a/wyoming_satellite/satellite.py +++ b/wyoming_satellite/satellite.py @@ -159,7 +159,7 @@ class SatelliteBase: try: await async_write_event(event, self._writer) except Exception as err: - self.clear_server() + await self.clear_server() if isinstance(err, ConnectionResetError): _LOGGER.warning("Server disconnected unexpectedly") @@ -558,7 +558,7 @@ class SatelliteBase: try: if mute_microphone: - with wave.open(wav_path, "rb") as wav_file: + with wave.open(str(wav_path), "rb") as wav_file: seconds_to_mute = wav_file.getnframes() / wav_file.getframerate() seconds_to_mute += self.settings.mic.seconds_to_mute_after_awake_wav