lxmf: Sideband voice messages (transcribe + Piper voice replies)
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.
This commit is contained in:
1 parent
b1a7bfd272
commit
ed894bd329
21 files changed
+1804
-78
No files matched your search
+21
-1
@@ -157,7 +157,27 @@
|
||||
"storage_path": "",
|
||||
"home_channel": "",
|
||||
"reply_prefix": "",
|
||||
"text_batch_delay": 0.8
|
||||
"text_batch_delay": 0.8,
|
||||
"result_only": true,
|
||||
"voice": {
|
||||
"enabled": false,
|
||||
"reply_with_voice": true,
|
||||
"max_speak_chars": 600,
|
||||
"reply_bitrate": 24000,
|
||||
"stt": {
|
||||
"model": "base.en",
|
||||
"device": "cpu",
|
||||
"compute_type": "int8",
|
||||
"language": "en"
|
||||
},
|
||||
"tts": {
|
||||
"voice": "en_US-lessac-medium",
|
||||
"voice_dir": "",
|
||||
"speaker_id": 0,
|
||||
"length_scale": 1.0,
|
||||
"volume": 1.0
|
||||
}
|
||||
}
|
||||
},
|
||||
"voice": {
|
||||
"enabled": false,
|
||||
|
||||
Reference in new issue
Block a user