14
14

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

BluemixのText to Speechを試してみたらゆっくりみたいだった

Posted at

Text to Speechとは?

Text to Speech(T2S、TTS)とは読んで字の如く、テキストを入れるとしゃべってくれるAPIだ。昨日T2Sのデモを見ていたら日本語が選べるじゃないか。これはやるしかない、ということで試してみた。

資格情報をゲットする

他のWatson APIと同じく、サービスを追加して資格情報をゲットする。ユーザーIDとパスワードが必要になる。なお、サービスの概要には日本語対応とは書いてない模様。

APIを確認する

T2SのAPI Referenceを見てみよう。なんとなんと、メソッドはsynthesize(しゃべらせる)とvoice(使える音声のリスト)しかない。

使える声を確認する

curlでvoiceをGETすると利用可能な声の一覧が出てくる。

$ curl -k -u "<T2SのユーザーID>:<T2Sのパスワード>" "https://stream.watsonplatform.net/text-to-speech/api/v1/voices"
{
   "voices": [
      {
         "url": "https://stream.watsonplatform.net/text-to-speech/api/v1/voices/en-US_MichaelVoice",
         "gender": "male",
         "name": "en-US_MichaelVoice",
         "language": "en-US",
         "description": "English language with US dialect, male voice.  The voice used by Watson Jeopardy system."
      },
      {
         "url": "https://stream.watsonplatform.net/text-to-speech/api/v1/voices/ja-JP_EmiVoice",
         "gender": "female",
         "name": "ja-JP_EmiVoice",
         "language": "ja-JP",
         "description": "Japanese language, female.  Higher-quality uncompressed Emi voice."
      },
      {
         "url": "https://stream.watsonplatform.net/text-to-speech/api/v1/voices/en-US_AllisonVoice",
         "gender": "female",
         "name": "en-US_AllisonVoice",
         "language": "en-US",
         "description": "English language with US dialect, female.  Higher-quality uncompressed Allison voice."
      },
      {
         "url": "https://stream.watsonplatform.net/text-to-speech/api/v1/voices/fr-FR_ReneeVoice",
         "gender": "female",
         "name": "fr-FR_ReneeVoice",
         "language": "fr-FR",
         "description": "French language with French dialect, female.  Higher-quality uncompressed Renee voice."
      },
      {
         "url": "https://stream.watsonplatform.net/text-to-speech/api/v1/voices/it-IT_FrancescaVoice",
         "gender": "female",
         "name": "it-IT_FrancescaVoice",
         "language": "it-IT",
         "description": "Italian language with Italian dialect, female.  Higher-quality uncompressed Francesca voice."
      },
      {
         "url": "https://stream.watsonplatform.net/text-to-speech/api/v1/voices/es-ES_LauraVoice",
         "gender": "female",
         "name": "es-ES_LauraVoice",
         "language": "es-ES",
         "description": "LLSS Spanish female Language with Castilian dialect. Laura talent"
      },
      {
         "url": "https://stream.watsonplatform.net/text-to-speech/api/v1/voices/de-DE_BirgitVoice",
         "gender": "female",
         "name": "de-DE_BirgitVoice",
         "language": "de-DE",
         "description": "German language with German dialect, female.  Higher-quality uncompressed Birgit voice."
      },
      {
         "url": "https://stream.watsonplatform.net/text-to-speech/api/v1/voices/es-ES_EnriqueVoice",
         "gender": "male",
         "name": "es-ES_EnriqueVoice",
         "language": "es-ES",
         "description": "LLSS Spanish Male Language with Castilian dialect. Enrique talent"
      },
      {
         "url": "https://stream.watsonplatform.net/text-to-speech/api/v1/voices/de-DE_DieterVoice",
         "gender": "male",
         "name": "de-DE_DieterVoice",
         "language": "de-DE",
         "description": "German language with German dialect, male.  Higher-quality uncompressed Dieter voice."
      },
      {
         "url": "https://stream.watsonplatform.net/text-to-speech/api/v1/voices/en-US_LisaVoice",
         "gender": "female",
         "name": "en-US_LisaVoice",
         "language": "en-US",
         "description": "English language with US dialect, female.  Higher-quality uncompressed Lisa voice."
      },
      {
         "url": "https://stream.watsonplatform.net/text-to-speech/api/v1/voices/en-GB_KateVoice",
         "gender": "female",
         "name": "en-GB_KateVoice",
         "language": "en-GB",
         "description": "English language with UK dialect, female.  Higher-quality uncompressed Kate voice."
      },
      {
         "url": "https://stream.watsonplatform.net/text-to-speech/api/v1/voices/es-US_SofiaVoice",
         "gender": "female",
         "name": "es-US_SofiaVoice",
         "language": "es-US",
         "description": "Spanish language with US dialect, female.  Higher-quality uncompressed Sofia voice."
      }
   ]
}

いた!エミさん!
ja-JP_EmiVoiceを指定すれば日本語が使えるようだ。

しゃべらせてみた

curlでGETしたらこうなってしまった。

curl -k -G -u "<T2SのユーザーID>:<T2Sのパスワード>" "https://stream.watsonplatform.net/text-to-speech/api/v1/synthesize" -d voice=ja-JP_EmiVoice --data-urlencode text="こんにちは"
▒▒▒.▒▒▒▒▒▒·▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒}▒L
▒/73/▒O▒                      ▒eL▒▒O▒▒o0
        H▒s)S.▒G_@]K▒_Ls▒▒ٽh檔3~▒▒3,k▒a▒▒+▒>b▒▒*bs▒Oŀ8▒"<ZHj▒▒O/+ ▒▒▒▒▒u▒▒e▒KaT▒룯r'▒▒▒▒*r▒?▒7R$▒▒ɍ▒k▒\▒▒:Nq▒(91▒▒
                                   ▒▒V▒Mc▒<Tt▒a▒@▒#▒▒▒▒7.▒▒i7/▒▒▒G▒▒▒nDը
p▒▒im▒ߖ▒.▒(T▒▒
              zV5▒▒▒
▒!al▒Akvn▒R▒x=G5M▒%0U▒▒▒Kn▒Hk▒윹▒SU▒▒▒▒'▒▒▒▒\S-▒'▒▒sמ▒RhB▒▒▒▒▒▒▒߼5▒j▒▒  ▒▒▒▒>▒▒▒

いやいや、これはおかしい。再生させたかったら結果をプレイヤーに投入しないといけないのかな。面倒なのでブラウザーで開いてしゃべらせることにする。

https://<T2SのユーザーID>:<T2Sのパスワード>@stream.watsonplatform.net/text-to-speech/api/v1/synthesize?voice=ja-JP_EmiVoice&text=こんにちは

・・・ゆっくり!ゆっくりじゃないか!!

おわりに

今まではマイケル(en-US_MichaelVoice)にローマ字で無理やりしゃべらせたりしていたけど、これからはエミちゃんがしゃべってくれるね!でも、どこかぎこちないので、これからどんどんなめらかにそして流暢になっていってくれるのを期待。あと男声とか、高い声/低い声とか色々出てきて欲しい。

14
14
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
14
14

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?