diff --git a/README.md b/README.md index bf182ef..4853234 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ For all other users, we have different installation methods available (Docker, s 💡 **Note:** There is an [environment variable](docs/install_application.md#environment-variables-reference) for each parameter if you use docker or systemd based setup. ```sh -usage: __main__.py [-h] [--name NAME] [--audio-input-device AUDIO_INPUT_DEVICE] [--list-input-devices] [--audio-input-block-size AUDIO_INPUT_BLOCK_SIZE] [--audio-output-device AUDIO_OUTPUT_DEVICE] [--list-output-devices] [--wake-word-dir WAKE_WORD_DIR] [--mic-auto-gain] [--mic-noise-suppression] +usage: __main__.py [-h] [--name NAME] [--audio-input-device AUDIO_INPUT_DEVICE] [--list-input-devices] [--audio-input-block-size AUDIO_INPUT_BLOCK_SIZE] [--audio-output-device AUDIO_OUTPUT_DEVICE] [--music-output-device MUSIC_OUTPUT_DEVICE] [--list-output-devices] [--wake-word-dir WAKE_WORD_DIR] [--mic-auto-gain] [--mic-noise-suppression] [--wake-model WAKE_MODEL] [--stop-model STOP_MODEL] [--download-dir DOWNLOAD_DIR] [--refractory-seconds REFRACTORY_SECONDS] [--wakeup-sound WAKEUP_SOUND] [--timer-finished-sound TIMER_FINISHED_SOUND] [--processing-sound PROCESSING_SOUND] [--mute-sound MUTE_SOUND] [--unmute-sound UNMUTE_SOUND] [--preferences-file PREFERENCES_FILE] [--host HOST] [--network-interface NETWORK_INTERFACE] [--port PORT] [--enable-thinking-sound] [--listen-during-wake-sound] [--debug] ``` @@ -85,6 +85,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 | +| `--music-output-device` | mpv name for the music/media output device | `--audio-output-device` | | `--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 | diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 319574e..1863692 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -44,6 +44,10 @@ if [ -n "${AUDIO_OUTPUT_DEVICE}" ]; then EXTRA_ARGS+=( "--audio-output-device" "$AUDIO_OUTPUT_DEVICE" ) fi +if [ -n "${MUSIC_OUTPUT_DEVICE}" ]; then + EXTRA_ARGS+=( "--music-output-device" "$MUSIC_OUTPUT_DEVICE" ) +fi + if [ -n "${MIC_VOLUME}" ]; then EXTRA_ARGS+=( "--mic-volume" "$MIC_VOLUME" ) fi diff --git a/docs/install_application.md b/docs/install_application.md index 9cb7d22..7bd3321 100644 --- a/docs/install_application.md +++ b/docs/install_application.md @@ -176,6 +176,7 @@ Environment=PREFERENCES_FILE="/home/pi/linux-voice-assistant/preferences.json" # Environment=PORT="6053" # Environment=AUDIO_INPUT_DEVICE="default" # Environment=AUDIO_OUTPUT_DEVICE="default" +# Environment=MUSIC_OUTPUT_DEVICE="default" # Environment=MIC_VOLUME="1.0" # Environment=MIC_AUTO_GAIN="0" # Environment=MIC_NOISE_SUPPRESSION="0" @@ -269,10 +270,11 @@ 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 | 100 | -| `MIC_AUTO_GAIN` | Add WebRTC Gain to Mic | 0 | -| `MIC_NOISE_SUPPRESSION` | Add WebRTC Noise Suppresion to Mic | 0 | -| `AUDIO_INPUT_CHANNELS` | Number of audio input channels | 2 | +| `MUSIC_OUTPUT_DEVICE` | `AUDIO_OUTPUT_DEVICE` | Music/media output device name (defaults to the voice output device) | +| `MIC_VOLUME` | 100 | Control microphone volume | +| `MIC_AUTO_GAIN` | 0 | Add WebRTC Gain to Mic | +| `MIC_NOISE_SUPPRESSION` | 0 | Add WebRTC Noise Suppression to Mic | +| `AUDIO_INPUT_CHANNELS` | 2 | Number of audio input channels | | `ENABLE_THINKING_SOUND` | false | Set to "1" to enable thinking sound | | `WAKE_WORD_DIR` | `app/wakewords` | Path to the wake word directory | | `WAKE_MODEL` | `okay_nabu` | Wake word model to use | @@ -286,7 +288,7 @@ The following variables can be configured in the `.env` or in the service file: | `PROCESSING_SOUND` | `sounds/processing.wav` | Sound file for processing state | | `LISTEN_DURING_WAKE_SOUND` | false | Set to "1" to start listening immediately after wake word detection, without waiting for the wake sound to finish | | `MUTE_SOUND` | `sounds/mute_switch_on.flac` | Sound file for mute on | -| `UNMUTE_SOUND` | `sounds/mute_switch_off.flac` | Sound file for Configure Audio Devices +| `UNMUTE_SOUND` | `sounds/mute_switch_off.flac` | Sound file for mute off | | `PERIPHERAL_HOST` | 0.0.0.0 | Host for the peripheral WebSocket API | | `PERIPHERAL_PORT` | 6055 | Port for the peripheral WebSocket API | | `PERIPHERAL_VOLUME_STEP` | %(default)s | Volume change per button press | diff --git a/linux_voice_assistant/__main__.py b/linux_voice_assistant/__main__.py index 39ce8ca..38526d4 100644 --- a/linux_voice_assistant/__main__.py +++ b/linux_voice_assistant/__main__.py @@ -66,6 +66,10 @@ async def main() -> None: "--audio-output-device", help="Name for the audio output device (see --list-output-devices)", ) + parser.add_argument( + "--music-output-device", + help="mpv name for the music/media output device (defaults to --audio-output-device)", + ) parser.add_argument( "--list-output-devices", action="store_true", @@ -419,7 +423,7 @@ async def main() -> None: wake_words=wake_models, active_wake_words=active_wake_words, stop_word=stop_model, - music_player=MpvMediaPlayer(device=args.audio_output_device), + music_player=MpvMediaPlayer(device=args.music_output_device or args.audio_output_device), tts_player=MpvMediaPlayer(device=args.audio_output_device), wakeup_sound=args.wakeup_sound, start_listening_sound=args.start_listening_sound,