LoginSignup
2
2

More than 5 years have passed since last update.

キノコやってみた Pepper x IBM Bluemix Text to Speech

Last updated at Posted at 2017-05-06

音声ファイルを作って、Pepperに話をさせる(再生)

text-to-speechとは

IBMの音声合成機能を使用して書かれたテキストを自然な音声に変換してくれます。
AWSでいうPollyと同じ。

Pepperの発話に苦戦

Pepperにいい感じに発話させるのって大変。しかも発音調整するには実機がないとできないから余計に大変
バーチャルロボットで確認できるならいいんだけど、そうもいかず。。これ、みんなどうしているんだろう??
みんな苦戦しているのでしょうか??

テキストを音声ファイルにして再生

というわけで、テキストを Text to Speech 使って音声ファイルに変換しダウンロード。それをそのまま発話させるということを試しました。

Bluemixで Text to Speechを作成

スクリーンショット 2017-05-06 18.24.42.png

アクションの「資格情報の表示」を押すと、usernameとpasswordが表示されるので、コレを使います。

pepper-pythonscript例
  url = "https://stream.watsonplatform.net/text-to-speech/api/v1/synthesize?accept=audio/wav&voice=ja-JP_EmiVoice"
  param = {"output" : "hello_world.wav", "text" : message}
  filePath = self.appFolder + "/" + self.getParameter("file name")
  r = requests.get(url, auth=("{username}", "{password}"), params=param)
  outfile = open(filePath, 'wb')
  outfile.write(r.content)
  outfile.close()

http get に、python requestsモジュールを使ってます。
このあたりが参考になります。
http://qiita.com/n0bisuke/items/5b782bb758ce5611cc90

paramでは、出力(ダウンロード)ファイル名と、変換元のテキストを設定しています。
requests.getで、先の資格情報とparamを設定し、request発行

Pepper内の filePath にしていた場所に outfile.write(r.content) にて保存されます。
あとは Play Soundボックスで再生すれば完成です。

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2