ksaitoの日記

日々試したことの覚え書き

しゃべるコンピュータ

移転しました。

自動的にリダイレクトします。

Macにテキストを音声に変換するsayコマンドというのがあります。
引数にテキストを指定するとMacがしゃべります。

$ say "this is a pen."

デフォルトでは、男性の声ですが、-vオプションで音声を選択できます。

$ say -v Victoria "This is a pen."

-vオプションで選択できる音声は、/System/Library/Speech/Voicesにファイルとして保存されています。

$ ls /System/Library/Speech/Voices/
Agnes.SpeechVoice	Bubbles.SpeechVoice	Organ.SpeechVoice
Albert.SpeechVoice	Cellos.SpeechVoice	Princess.SpeechVoice
Alex.SpeechVoice	Deranged.SpeechVoice	Ralph.SpeechVoice
BadNews.SpeechVoice	Fred.SpeechVoice	Trinoids.SpeechVoice
Bahh.SpeechVoice	GoodNews.SpeechVoice	Vicki.SpeechVoice
Bells.SpeechVoice	Hysterical.SpeechVoice	Victoria.SpeechVoice
Boing.SpeechVoice	Junior.SpeechVoice	Whisper.SpeechVoice
Bruce.SpeechVoice	Kathy.SpeechVoice	Zarvox.SpeechVoice
$

sayコマンドは、日本語には対応していないみたいです。
日本語を指定しても、全く反応しませんでした。

$ say "こんにちは"

ローマ字テキストにすると外国人なまりの日本語で発音されて、ちょっとおもしろいです。

$ say konnichiwa
$ say kon nichi wa
$ say con nichi wa