Add --music-output-device to route music separately from voice (#350)
* Add --music-output-device to route music separately from voice Music/media and TTS both play through --audio-output-device today, with no way to send them to different sinks. Add an optional --music-output-device (env MUSIC_OUTPUT_DEVICE) that the music player uses instead, defaulting to --audio-output-device so existing setups are unchanged. Wired through docker-entrypoint.sh and documented in the README and install docs. * docs: fix swapped Default/Description columns in env var table The MIC_VOLUME, MIC_AUTO_GAIN, MIC_NOISE_SUPPRESSION and AUDIO_INPUT_CHANNELS rows had their Default and Description columns swapped relative to the table header; fix the ordering and the 'Suppresion' misspelling. Also repair the UNMUTE_SOUND row, whose description was garbled and which was missing its closing table pipe. --------- Co-authored-by: Matthew Davis <fedoraproject@virtual.drop.net> Co-authored-by: Florian Asche <github@florian-asche.de> Co-authored-by: Omar Amin <65174210+omaramin-2000@users.noreply.github.com>
This commit is contained in:
4 files changed
+18
-7
No files matched your search
@@ -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.
|
💡 **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
|
```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]
|
[--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]
|
[--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-device` | Soundcard name for input device | Autodetected |
|
||||||
| `--audio-input-block-size` | Audio input block size in samples | 1024 |
|
| `--audio-input-block-size` | Audio input block size in samples | 1024 |
|
||||||
| `--audio-output-device` | mpv name for output device | Autodetected |
|
| `--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-volume` | Control microphone volume | 100 |
|
||||||
| `--mic-auto-gain` | Add WebRTC Gain to Mic | 0 |
|
| `--mic-auto-gain` | Add WebRTC Gain to Mic | 0 |
|
||||||
| `--mic-noise-suppression` | Add WebRTC Noise Suppression to Mic | 0 |
|
| `--mic-noise-suppression` | Add WebRTC Noise Suppression to Mic | 0 |
|
||||||
|
|||||||
@@ -44,6 +44,10 @@ if [ -n "${AUDIO_OUTPUT_DEVICE}" ]; then
|
|||||||
EXTRA_ARGS+=( "--audio-output-device" "$AUDIO_OUTPUT_DEVICE" )
|
EXTRA_ARGS+=( "--audio-output-device" "$AUDIO_OUTPUT_DEVICE" )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -n "${MUSIC_OUTPUT_DEVICE}" ]; then
|
||||||
|
EXTRA_ARGS+=( "--music-output-device" "$MUSIC_OUTPUT_DEVICE" )
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -n "${MIC_VOLUME}" ]; then
|
if [ -n "${MIC_VOLUME}" ]; then
|
||||||
EXTRA_ARGS+=( "--mic-volume" "$MIC_VOLUME" )
|
EXTRA_ARGS+=( "--mic-volume" "$MIC_VOLUME" )
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -176,6 +176,7 @@ Environment=PREFERENCES_FILE="/home/pi/linux-voice-assistant/preferences.json"
|
|||||||
# Environment=PORT="6053"
|
# Environment=PORT="6053"
|
||||||
# Environment=AUDIO_INPUT_DEVICE="default"
|
# Environment=AUDIO_INPUT_DEVICE="default"
|
||||||
# Environment=AUDIO_OUTPUT_DEVICE="default"
|
# Environment=AUDIO_OUTPUT_DEVICE="default"
|
||||||
|
# Environment=MUSIC_OUTPUT_DEVICE="default"
|
||||||
# Environment=MIC_VOLUME="1.0"
|
# Environment=MIC_VOLUME="1.0"
|
||||||
# Environment=MIC_AUTO_GAIN="0"
|
# Environment=MIC_AUTO_GAIN="0"
|
||||||
# Environment=MIC_NOISE_SUPPRESSION="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 |
|
| `PORT` | `6053` | API server port |
|
||||||
| `AUDIO_INPUT_DEVICE` | Autodetected | Audio input device name |
|
| `AUDIO_INPUT_DEVICE` | Autodetected | Audio input device name |
|
||||||
| `AUDIO_OUTPUT_DEVICE` | Autodetected | Audio output device name |
|
| `AUDIO_OUTPUT_DEVICE` | Autodetected | Audio output device name |
|
||||||
| `MIC_VOLUME` | Control microphone volume | 100 |
|
| `MUSIC_OUTPUT_DEVICE` | `AUDIO_OUTPUT_DEVICE` | Music/media output device name (defaults to the voice output device) |
|
||||||
| `MIC_AUTO_GAIN` | Add WebRTC Gain to Mic | 0 |
|
| `MIC_VOLUME` | 100 | Control microphone volume |
|
||||||
| `MIC_NOISE_SUPPRESSION` | Add WebRTC Noise Suppresion to Mic | 0 |
|
| `MIC_AUTO_GAIN` | 0 | Add WebRTC Gain to Mic |
|
||||||
| `AUDIO_INPUT_CHANNELS` | Number of audio input channels | 2 |
|
| `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 |
|
| `ENABLE_THINKING_SOUND` | false | Set to "1" to enable thinking sound |
|
||||||
| `WAKE_WORD_DIR` | `app/wakewords` | Path to the wake word directory |
|
| `WAKE_WORD_DIR` | `app/wakewords` | Path to the wake word directory |
|
||||||
| `WAKE_MODEL` | `okay_nabu` | Wake word model to use |
|
| `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 |
|
| `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 |
|
| `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 |
|
| `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_HOST` | 0.0.0.0 | Host for the peripheral WebSocket API |
|
||||||
| `PERIPHERAL_PORT` | 6055 | Port for the peripheral WebSocket API |
|
| `PERIPHERAL_PORT` | 6055 | Port for the peripheral WebSocket API |
|
||||||
| `PERIPHERAL_VOLUME_STEP` | %(default)s | Volume change per button press |
|
| `PERIPHERAL_VOLUME_STEP` | %(default)s | Volume change per button press |
|
||||||
|
|||||||
@@ -66,6 +66,10 @@ async def main() -> None:
|
|||||||
"--audio-output-device",
|
"--audio-output-device",
|
||||||
help="Name for the audio output device (see --list-output-devices)",
|
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(
|
parser.add_argument(
|
||||||
"--list-output-devices",
|
"--list-output-devices",
|
||||||
action="store_true",
|
action="store_true",
|
||||||
@@ -419,7 +423,7 @@ async def main() -> None:
|
|||||||
wake_words=wake_models,
|
wake_words=wake_models,
|
||||||
active_wake_words=active_wake_words,
|
active_wake_words=active_wake_words,
|
||||||
stop_word=stop_model,
|
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),
|
tts_player=MpvMediaPlayer(device=args.audio_output_device),
|
||||||
wakeup_sound=args.wakeup_sound,
|
wakeup_sound=args.wakeup_sound,
|
||||||
start_listening_sound=args.start_listening_sound,
|
start_listening_sound=args.start_listening_sound,
|
||||||
|
|||||||
Reference in new issue
Block a user