[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
erc-speak.el -- Speech enable ERC Internet Relay Chat Client
- To: email@example.com
- Subject: erc-speak.el -- Speech enable ERC Internet Relay Chat Client
- From: Mario Lang <firstname.lastname@example.org>
- Date: 21 Jun 2001 01:32:51 +0200
- Resent-Date: Thu, 21 Jun 2001 00:16:25 -0400 (EDT)
- Resent-From: email@example.com
- Resent-Message-ID: <"7ozodD.A.YNH.JOXM7"@hub>
- Resent-Sender: firstname.lastname@example.org
- User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7
Hello. I am currently hacking on my first bit more complicated
Lisp program. And I wanted to pass it on to you so that you could
experiment with it or drom me comments.
Please note that I use the script primarily to listen to channels,
but I am not a primary speech user (braille display). So there
are probably many things you as speech only user wouldn't like.
This is a pre-pre-pre-alpha-gamma-ray test version. So dont expect
it to be perfect. For wishes, look at the Todo list first.
If you like this and have some spare time, send me additions.
Here we go:
;;; erc-speak.el -- Speech-enable the ERC chat client
;; Copyright 2001 Mario Lang <email@example.com>
;; This file is protected by the GNU GPL, same conditions as with
;; Emacs apply, although this file is not part of GNU Emacs.
;; This file contains code to speech enable ERC using Emacspeaks functionality
;; to access a speech synthesizer.
;; It tries to be intelligent and produce actually understandable
;; audio streams :). Hopefully it does. I use it on #debian at irc.debian.org
;; with about 200 users, and I am amazed how easy it works.
;; Currently, erc-speak is only written to listen to channels.
;; There is no special functionality for interaction in the erc buffers.
;; Although this shouldn't be hard. Look at the Todo list, there are
;; definitely many things this script could do nicely to make a better
;; IRC experience for anyone.
;; More info? Read the code. It isn't that complicated.
;; Change the (load ...) calls at the beginning of code to point
;; to your erc.el and edo-tools.el files.
;; And load this file.
;; erc-speak-rate doesn't seem to work here on outloud. Can anyone enlighten
;; me on the use of dtk-interp-queue-set-rate or equivalents?
;; * Rewrite erc-speak-join and write erc-speak-part/quit to also
;; use the queue and use erc-speak-debug instead of poor format.
;; * Write acronym handling functions and lists
;; * ACTIONs (spoken with a third voice)
;; * Optimize erc-speak-to-whom for more intelligence
;; * Introduce nickname mapping to something alternatively (names
;; or sounds)
;; * Implement bold and perhaps colors
;; * Convert defvar to defcustom where useful.
;; * Check library header to make something more LCD like.
;; * Add your wish here.
(defvar erc-speak-moderator 'harry
"Voice used for the moderator (who writes where to whom)")
(defvar erc-speak-person 'paul
"Voice used for message content")
(defvar erc-speak-debug t
"Define whether or not erc-speak should log the content
it receives via the hooks.
We are simply using erc-log-aux and ignoree the erc-debug settings.")
(defvar erc-speak-rate 85
"The speech rate for IRC traffic.
BUG: dtk-interp-queue-set-rate seems to not work. Any hints?")
(defvar erc-speak-quiet nil
"Set this to prevent erc-speak from actually talking.
nil - Happily talk away
'maybe - Don't talk, but keep things in the queue for analysis or later
't - Don't talk and discard messages.
You can manipulate the queue when this variable is either nil nor t.")
(defvar erc-speak-message-queue nil
"A FIFO for messages.")
(defun erc-speak-queue-message (message target nick buffer-name host login spec)
"Appends the values received by erc-message-hook to erc-speak-message-queue."
(erc-log-aux (erc-speak-debug 'erc-speak-message
(list (list message target nick buffer-name host login spec)))))
(defun erc-speak-to-whom (message nicks)
"Find out if message addresses one of nicks nicknames.
If true, nickname is returned, otherwise nil."
(mapcar (lambda (x) (concat "\\|" x )) nicks))
(substring message (match-beginning 1) (match-end 1))
(defun erc-speak-message ()
"This function is called via the timer every once in a while.
It pops one or more items of the queue and send them to the speech
server. (intelligence not implemented yet)"
(if (eq erc-speak-quiet 'nil)
(let* ((item (car erc-speak-message-queue))
(message (car item))
(target (car (cdr item)))
(nick (car (nthcdr 2 item)))
(buffer (car (nthcdr 3 item))))
(mapcar (lambda (x) (car x))
(to-whom (erc-speak-to-whom message members)))
(if (eq (elt target 0) ?#)
(format "%s: %s"
(concat "" (substring target 1) ":")
(format "%s writes to %s" nick to-whom)
(format "Message from %s" nick)))
(substring message (match-end 0))
(setq erc-speak-message-queue (cdr erc-speak-message-queue))
(defvar erc-speak-message-timer nil
"Holds the timer object used to speak messages.
Use it with cancel-timer to remove erc-speak-queue-message")
(defvar erc-speak-idle-time 5
"Start speaking IRC information after specified time.
Actually this currently means \"Try to pop from the FIFO every SEC seconds\".
Idle time behaviour still has to be written (how to find out how long Emacs
(defun erc-speak-setup ()
"Initialize the timer functions and add hooks."
(add-hook 'erc-message-hook 'erc-speak-queue-message)
;; Join and part behaviour has still to be integrated into the queue
;; Wondering if this makes sense anyway.
(add-hook 'erc-join-hook 'erc-speak-join))
(defun erc-speak-join (channel nick buffer ip login spec)
"Attempts to voicify join events."
(format "\t\"%s\" ;; channel\n\t\"%s\" ;; nick\n\t\"%s\" ;; buffer\n\t\"%s\" ;; ip\n\t\"%s\" ;; login\n\t\"%s\" ;; spec)\n"
channel nick buffer ip login spec))))
(if (not erc-speak-quiet)
(format "%s joined channel %s"
(defun erc-speak-debug (name &rest list)
"Return useful debug message."
(let ((item list)
(result (concat "'(" (symbol-name name) "\n")))
(setq result (concat result
(symbol-name (car (cdr item)))
(setq item (nthcdr 2 item)))
(concat result ")")))
;; End of file:
Homepage(s): http://delysid.org | http://piss.at/
Linux: Because a PC is a terrible thing to waste.
(By firstname.lastname@example.org, Mark Komarinski)
To unsubscribe from the emacspeak list or change your address on the
emacspeak list send mail to "email@example.com" with a
subject of "unsubscribe" or "help"
Emacspeak Files |
Unsubscribe | Search