Skip to content

brhacket/tts_weechat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

                                 __ _          _                _        _  __ 
                                | _| |__  _ __| |__   __ _  ___| | _____| ||_ |
                                | || '_ \| '__| '_ \ / _` |/ __| |/ / _ \ __| |
                                | || |_) | |  | | | | (_| | (__|   <  __/ |_| |
                                | ||_.__/|_|  |_| |_|\__,_|\___|_|\_\___|\__| |
                                |__|                                       |__|

Python Platform License

A Zero-Latency, Thread-Safe Text-to-Speech integration for WeeChat.


📖 About

This script bridges WeeChat messages to your system's speech-dispatcher (spd-say).

While most TTS scripts suffer from crashes, threading lockups, or audio lag, this project was built for Fedora 43 / KDE 6 (but works everywhere) to solve those issues. It supports Piper TTS, Festival, and Espeak out of the box.

✨ Key Features

  • ⚡ Zero Latency Queue
    • No waiting. Messages are read the instant they arrive via a dedicated thread.
  • 🧠 Smart Sequencing
    • No Repetition: If UserA sends 3 messages, it says: "UserA says. Hello. How are you." (It doesn't repeat the name).
    • Turn-Taking: If UserB interrupts, it switches speakers instantly.
  • 🗣️ Nickname Humanizer
    • MuddyMacey"Muddy Macey"
    • brhacket42"brhacket 42"
    • Shmoo"shmoo" (Forces phonetic reading vs spelling letters).
  • 🔇 Smart Filtering
    • Focus Mode: Only reads the chat you are actively looking at.
    • Background Alerts: Plays a sound and says "New message in #channel" if you are pinged elsewhere.
  • 💾 Persistent Config
    • Remembers your volume, sound preferences, and active channels after restart.

📦 Installation

1. Install Dependencies

You need WeeChat (with Python support) and Speech Dispatcher.

Fedora:

sudo dnf install weechat weechat-python speech-dispatcher-utils

Ubuntu/Debian:

sudo apt install weechat weechat-python speech-dispatcher

2. Install the Script

mkdir -p ~/.local/share/weechat/python/
# Assumes you are inside the repo folder
cp tts_weechat.py ~/.local/share/weechat/python/

3. Load in WeeChat

Run these commands inside WeeChat:

/plugin load python
/python load tts_weechat.py
/script autoload tts_weechat.py

🎮 Controls & Usage

Note: By default, TTS is OFF to prevent spam. Enable it using /listento.

🎛️ Core Commands

Command Usage Description
/listento /listento Lock TTS to current chat. (Enables Audio)
/listento auto Follow Focus. Reads whatever chat you click on.
/listento off Disable TTS.
/shh /shh Mute Voice. (Keeps background notification sounds).
/shh all Mute Everything (Silence).
/shh disable Unmute.

⚙️ Configuration

Command Usage Description
/setsound /setsound [type] Choose BG alert sound: chime, bell, alert, off.
/ignoreme /ignoreme [on/off] Read my own messages? (Default: off = Read them).
/iam /iam [nick] Manually set your nickname if auto-detection fails.
/ttsdbg /ttsdbg [on/off] View debug logs in chat window.

🎙️ High-Quality Voices (Piper TTS)

To get modern AI voices on Linux (Fedora/KDE):

  1. Install Pied (via Flatpak/Flathub).
  2. Download a neural voice (e.g., en_US-lessac-medium).
  3. In Pied, click the voice to configure speech-dispatcher.
  4. Restart the daemon:
    killall speech-dispatcherd
  5. This script will automatically detect the new voice.

Created by brhacket • License GPL3

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages