def setup
background(220)
speech_j = Speech.new("Google 日本語")
speech_e = Speech.new("Google US English")
button_j = createButton("日本語").size(80, 25).position(10, 20)
button_e = createButton("English").size(80, 25).position(10, 55)
button_j.mousePressed do
speech_j.rate(1.2) # 速さ(0.1~10.0)
.pitch(1.0) # 高さ(0.0~ 2.0)
.volume(1.0) # 音量(0.0~ 1.0)
.speak("みなさん、こんにちは")
end
button_e.mousePressed do
speech_e.rate(1.0) # 速さ(0.1~10.0)
.pitch(1.0) # 高さ(0.0~ 2.0)
.volume(1.0) # 音量(0.0~ 1.0)
.speak("Hello, everyone")
end
end
発話オブジェクトを生成します。
| 引数名 | 内容 | 備考 | オプション | デフォルト値 |
|---|---|---|---|---|
| voice | ボイス名 | おもなボイス名 "Google 日本語" "Google US English" "Google Deutsch" "Google français" "Google italiano" "Google 國語(臺灣)" | ○ | nil (デフォルトのボイスを採用) |
speech : speechオブジェクト
・指定できるボイス名は、ブラウザや地域などによって異なります。