Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@DeaR
Created February 6, 2013 11:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DeaR/4721934 to your computer and use it in GitHub Desktop.
Save DeaR/4721934 to your computer and use it in GitHub Desktop.
このxyzzy…しゃべるぞ!
; Shaberu.l
; 元ネタ: http://blog.supermomonga.com/articles/vim/shaberu-vim.html
; 棒読みちゃんを起動しておいてください
; http://chi.usamimi.info/Program/Application/BouyomiChan/
(defconstant *shaberu-addr* "127.0.0.1")
(defconstant *shaberu-port* 50001)
(defun shaberu-say (str)
(with-open-stream (stream (connect *shaberu-addr* *shaberu-port*))
; command
(write-char #\x01 stream)
(write-char #\x00 stream)
; speed
(write-char #\xff stream)
(write-char #\xff stream)
; tone
(write-char #\xff stream)
(write-char #\xff stream)
; volume
(write-char #\xff stream)
(write-char #\xff stream)
; voice
(write-char #\x00 stream)
(write-char #\x00 stream)
; encode
(write-char #\x02 stream)
; length
(let ((len (+ (length str) (count #\xff str :test #'char<=))))
(write-char (code-char (logand #xff (ash len 0))) stream)
(write-char (code-char (logand #xff (ash len -8))) stream)
(write-char (code-char (logand #xff (ash len -16))) stream)
(write-char (code-char (logand #xff (ash len -24))) stream))
; data
(format stream str)))
(shaberu-say "このxyzzy…しゃべるぞ!")
@DeaR
Copy link
Author

DeaR commented Feb 6, 2013

(defun ed::msgbox (fmt &rest args)
  (shaberu-say (format nil fmt args)))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment