The LXMF gateway now handles Sideband push-to-talk voice messages end to end. Inbound: a PTT message carries its audio in LXMF.FIELD_AUDIO (`[audio_mode, bytes]`); `lxmf_transport.parse_audio_field` normalizes it and the adapter transcribes it into an ordinary command when `gateway.lxmf.voice.enabled` is set. HQ Opus/OGG goes through faster-whisper (requirements/transcribe.txt); non-HQ Codec2 through the optional pycodec2 bindings (requirements/codec2.txt). No microphone stack is needed. Outbound: a chat that last messaged by voice is answered with a synthesized voice message when `gateway.lxmf.voice.reply_with_voice` is on (the default). `voice_transport.build_synthesizer` speaks the reply with Piper and `voice_transport.pcm_to_opus_ogg` encodes it to OGG/Opus (48 kHz, PyAV's libopus); `lxmf_transport.audio_fields` attaches it as a Sideband HQ PTT message, with the reply text as the content so a text-only client still sees it. The reply mode follows the chat's most recent inbound message. A missing synthesizer or any synthesis/encode failure is traced and the reply falls back to text. Deps: requirements/tts.txt (piper-tts + PyAV), still no microphone. Also make LXMF replies result-only (`LxmfAdapter.result_only`, overridable via `gateway.lxmf.result_only: false`): send the skill's result line, dropping scheduler bookkeeping and the `<skill>: ok —` wrapper. Wiring: new config keys under `gateway.lxmf` (result_only) and `gateway.lxmf.voice` (reply_with_voice, max_speak_chars, reply_bitrate, tts); regenerated config.example.json; the setup interview asks how to handle voice messages and the install plan adds `install_lxmf_tts` (bootstrap installs requirements/tts.txt and downloads the reply voice); cli anchors the LXMF voice_dir to .runtime/voice/tts. Tests cover the audio field shape, the outbound queue, the adapter's voice-chat tracking and synthesis fallbacks, result-only routing, the synthesis/encode helpers, and the setup plan. Docs updated.
40 lines
1.8 KiB
Plaintext
40 lines
1.8 KiB
Plaintext
# Voice gateway deps (optional, hardware-dependent).
|
|
#
|
|
# Only needed on a host that runs the voice front end
|
|
# (`python -m semif_agent.cli gateway --platform voice`). Lazy-imported by
|
|
# semif_agent/voice_transport.py, so the core stays stdlib-only on every other
|
|
# host. Install with scripts/bootstrap.sh --voice, or:
|
|
# .runtime/venv/bin/pip install -r requirements/voice.txt
|
|
# .runtime/venv/bin/pip install --no-deps openwakeword==0.6.0
|
|
#
|
|
# System prerequisites (not pip): PortAudio + ALSA mixer tools, e.g.
|
|
# `apt-get install -y libportaudio2 alsa-utils`. PortAudio is the I/O backend;
|
|
# alsa-utils provides amixer/alsamixer/alsactl to unmute and set mic/speaker
|
|
# levels (PortAudio itself has no volume control).
|
|
#
|
|
# The audio pipeline is 16 kHz mono int16:
|
|
# sounddevice mic capture + speaker playback (raw PortAudio streams)
|
|
# faster-whisper CTranslate2 Whisper speech-to-text (model from HF cache)
|
|
# piper-tts local neural text-to-speech (voice .onnx under .runtime/voice/tts)
|
|
# onnxruntime inference backend for openwakeword + piper
|
|
# webrtcvad-wheels VAD endpointing (imports as `webrtcvad`; prebuilt wheels)
|
|
#
|
|
# openWakeWord is installed SEPARATELY with --no-deps: its Linux metadata
|
|
# hard-requires tflite-runtime, which has no py3.12+ wheel. The onnxruntime
|
|
# backend (used here) does not need it. Its own runtime deps are pinned below
|
|
# so this file alone is enough for the rest of the stack.
|
|
sounddevice==0.5.6
|
|
onnxruntime==1.30.0
|
|
faster-whisper==1.2.1
|
|
# PyAV 19.0.0 removed the `metadata_errors` argument that faster-whisper 1.2.1
|
|
# still passes to av.open(), breaking every transcription; see
|
|
# requirements/transcribe.txt for the full note.
|
|
av<19
|
|
piper-tts==1.8.0
|
|
webrtcvad-wheels==2.0.14.post1
|
|
# openwakeword runtime deps (installed here because openwakeword is --no-deps).
|
|
scipy==1.18.1
|
|
scikit-learn==1.9.1
|
|
requests==2.34.2
|
|
tqdm==4.70.1
|