時報がわりにニュースを読み上げるのも面白いかもしれません。
あとは地震速報とか。
応用はいろいろありそうです。
手順についてメモしておきます。
まず、PPMで Win32::SAPI4 をインストール。(今までインストールしていなかったので)
ppm> install Win32-SAPI4
plaggerを実行してみると以下のエラー。
Can't call method "Language2LanguageID" on an undefined value at C:/Perl/site/lib/Plagger/Plugin/Publish/Speech/Win32.pm line 36.
Windows XPでは、Microsoft Speech API 5 (SAPI5)と英語の読み上げエンジンが入っています。
コントロールパネルの音声認識で「音声の選択」に表示される「Microsoft Sam」がそれです。
しかし、Plagger::Plugin::Publish::Speech::Win32 で使う Win32::SAPI4 では、
Microsoft Speech API 4 を使うので、いくつかインストールする必要があります。
以下のページにまとまっています。
Microsoft Agent downloads for end-users
- Microsoft Agent and localization support:
XPの場合、core componentsはインストールされているので、日本語の language component(AgtX0411.exe)をダウンロード。 - Text-to-speech engines:
Lernout & Hauspie TruVoice TTS engine - American English(tv_enua.exe)と Lernout & Hauspie TTS3000 TTS engine - Japanese(lhttsjpj.exe)をダウンロード。 - SAPI 4.0 runtime support:
Download the Microsoft SAPI 4.0a runtime binaries(spchapi.exe)をダウンロード。
speech-config.yaml は以下のような感じで。
global:
plugin_path:
- C:\Perl\site\lib\Plagger\Plugin
assets_path: C:\Perl\site\lib\Plagger\assets
timezone: Asia/Tokyo
log:
level: debug
cache:
base: C:\plagger
plugins:
# - module: Filter::EntryFullText
- module: Subscription::Config
config:
feed:
- url: http://www3.asahi.com/rss/index.rdf
- module: Filter::Rule
rule:
module: Fresh
mtime:
path: C:\plagger\tmp\speech.mtime
autoupdate: 1
- module: Publish::Speech
# config:
# voice: 11
Subscription::Config でフィードを指定。
Filter::Rule で C:\plagger\tmp\speech.mtime の更新日時より新しいものだけにする。
ちなみに、autoupdate を 0 にすると、plagger実行時にファイルのmtimeを更新しないので、
テストにいいかと思います。
subtechグループ - Bulknews::Subtech - atode.cc クローン by Plagger
等を参考にしました。
フィードに日本語が含まれていれば、日本語の読み上げエンジンで読み上げ、
英語のみのフィードなら英語エンジンで読み上げてくれるようです。たぶん。
また、Publish::Speech の configで voiceを指定するといろいろ変更できるようです。
実行時のログは以下のようになります。
C:\>plagger -c \plagger\speech-config.yaml Plagger [info] plugin Plagger::Plugin::Subscription::Config loaded. Plagger [info] plugin Plagger::Plugin::Filter::Rule loaded. Plagger [info] plugin Plagger::Plugin::Publish::Speech loaded. Plagger [info] plugin Plagger::Plugin::Aggregator::Simple loaded. Plagger::Plugin::Aggregator::Simple [info] Fetch http://www3.asahi.com/rss/index.rdf Plagger::Cache [debug] Cache HIT: aggregator-simple|http://www3.asahi.com/rss/index.rdf Plagger::Plugin::Aggregator::Simple [debug] 200: http://www3.asahi.com/rss/index.rdf Plagger::Plugin::Aggregator::Simple [info] Aggregate http://www3.asahi.com/rss/index.rdf success: 39 entries. Use of uninitialized value in string eq at C:/Perl/site/lib/Win32/SAPI4.pm line 106. Plagger::Plugin::Publish::Speech::Win32 [debug] Found voice 1 for Lang ja and Gender 1
上記の例の asahi.comのRSSはタイトルのみですが、EntryFullText のパターンファイルがあるので、
Filter::EntryFullText を有効にすれば全文を読み上げさせることもできます。
Feed Upgraderの一覧は以下にあります。かなり充実してきてますね。
/trunk/plagger/assets/plugins/Filter-EntryFullText - Plagger - Trac
BBC
なんかもいいですね。
でも、読み上げの時に、タイトルと本文(title_text と body_text)の間に一呼吸あるといいかも。
次は、 Plagger::Plugin::Publish::MSAgent: blog.bulknews.net で紹介されていたプラグインで Microsoft Agentに喋らせてみました。











人気ブログランキング・ランブロの管理人です。
このたび、アクセスアップにお役に立てるよう、人気ブログランキング・ランブロを開始しました。
(他のランキングとは違い、カテゴリごとに、ランダムにブログが表示されたりします。)
まだ、開始したばかりですので、登録数などは少ないですが、これから、登録数などを増やしていきたいと考えております。
そこで、登録して、ご利用いただけたら、と思います。
よろしくお願いいたします。
http://www.ranblo.com/
トラックバックセンターも開始しました。ご活用ください。
http://ranblotb.seesaa.net