[表示 : 全て 最新50 1-99 101- 201- 301- 401- 501- 601- 701- 801- 2chのread.cgiへ]
Update time : 05/25 03:24 / Filesize : 216 KB / Number-of Response : 877
[このスレッドの書き込みを削除する]
[+板 最近立ったスレ&熱いスレ一覧 : +板 最近立ったスレ/記者別一覧] [類似スレッド一覧]


↑キャッシュ検索、類似スレ動作を修正しました、ご迷惑をお掛けしました

Emacs Part 39



437 名前:名無しさん@お腹いっぱい。 mailto:sage [2012/01/02(月) 20:06:07.02 ]
emacs に喋らせたくて google 翻訳使ったのを作ったんだけど、日本語含むのがちゃんと動かない。
url-hexify-string の中で encode-coding-string utf-8 してるから問題ないと思ったんだけど何が不味いんだろう。
助言をください・・・

(require 'url-http)
(defvar speech-default-language "en"
"デフォルトの言語。")
(defvar speech-sound-player "cmd /c start %s"
"mp3音声再生プログラム。%s にファイル名が入る。") ;; windows 向け設定

(defun speech-message (text &optional lang)
"指定された文章を音声再生する。"
(interactive "sMessage: ")
(let ((coding-system-for-read 'binary)
(coding-system-for-write 'binary)
temp-file)
(with-current-buffer
(url-retrieve-synchronously
(format "translate.google.com/translate_tts?tl=%s&q=%s?"
(or lang speech-default-language)
(url-hexify-string text)))
(set-buffer-multibyte nil)
(setq temp-file (make-temp-file "speech-" nil ".mp3"))
(write-region (point-min) (point-max) temp-file nil 'silent)
(apply 'start-process "player" nil
(split-string (format speech-sound-player temp-file))))))

;; 以下を評価でしゃべる
(speech-message "a happy new year!")
(speech-message "a happy new year!" "ja") ;; 言語指定
(speech-message "あけましておめでとうございます" "ja") ;; 動作がおかしい...






[ 続きを読む ] / [ 携帯版 ]

全部読む 前100 次100 最新50 [ このスレをブックマーク! 携帯に送る ] 2chのread.cgiへ
[+板 最近立ったスレ&熱いスレ一覧 : +板 最近立ったスレ/記者別一覧]( ´∀`)<216KB

read.cgi ver5.27 [feat.BBS2 +1.6] / e.0.2 (02/09/03) / eucaly.net products.
担当:undef