2010-01-07

Mac 終端機 Terminal 裡好玩的 SAY 指令!



前幾天Seal 在網路上亂逛的時候,發現了Mac 裡面有一個好玩的指令 "Say" 指令
這是一個指令可以讓你的蘋果電腦,說出你在終端機輸入的任何英文句子!
如果臨時需要知道某個字的發音的話,還不錯用。不過這些都是合成音,有時候還是不太準確的!
參考參考就好囉,而且還滿好玩的,有輸入標點符號的話,音調還會跟著改變喔!

Seal 就在這邊稍微翻譯一下官方的使用手冊文件給各位參考參考!

Mac OS X Manual Page For Say


NAME
指令名稱
say - Convert text to audible speech
say - 把文字轉換成語音

SYNOPSIS
指令概要
say [-v voice] [-o outfile [audio format options] | -n name:port ] ... [-f file | string ...]

DESCRIPTION
指令描述
This tool uses the Speech Synthesis manager to convert input text to audible speech and either play
it through the sound output device chosen in System Preferences or save it to an AIFF file.
這個工具是使用語音合成器來把使用者所輸入的文字轉換成語音並使用系統預設的
輸出裝置來撥放出來,或者是可以另外儲存成AIFF 語音檔案。

OPTIONS
選項
string
字串
Specify the text to speak on the command line. This can consist of multiple arguments, which are
considered to be separated by spaces.
在指令中輸入欲轉換的文字內容。這個可以可以有很多的變化,會使用空格來做判斷。

-f file, --input-file=file
-f file, 檔案位置及名稱 = file
Specify a file to be spoken. If file is - or neither this parameter nor a message is specified,
read from standard input.
選擇一個檔案來轉換成語音。如果檔案沒有特別指定,會使用預設指來做轉換。

-v voice, --voice=voice
-v voice, 選擇的聲音 = voice
Specify the voice to be used. Default is the voice selected in System Preferences.
可以自定需要使用的聲音,預設值與系統設定中的值是相同的。

-o out.aiff, --output-file=file
-o out.aiff,欲儲存的檔案路徑及名稱 = file
Specify the path for an audio file to be written. AIFF is the default and should be supported for
most voices, but some voices support many more file formats.
指定一個可以儲存的路徑及名稱。AIFF 是預設可以支援的檔案種類,有些聲音可以儲存成
其他不同的檔案格式。

EXAMPLES (範例)
say Hello, World
(這時候電腦就會說 Hello, World)
say -v Alex -o hi -f hello_world.txt
(電腦會使用Alex 的聲音 打開hello_world.txt,將裡面的內容轉換成聲音檔並且存成hi.aiff)
say -o hi.aac Hello, World
(電腦把Hello, World 轉換成語音並存成hi.acc 檔案)

-------------------------------- Seal 後記 ----------------------------------

Seal 只翻了一些比較重要的片段,玩玩好玩就好囉
如果有需要的朋友,請自己上官方的參考文件去看看囉
不會很難懂啦,真的滿有趣的!

1 則留言: