Help us understand the problem. What is going on with this article?

IBM Watson text-to-speechを試す(Ruby POST版)

More than 3 years have passed since last update.

IBM Watson text-to-speechを試す(POST版)のRuby版

textToSpeechPost.rb
require 'rest-client'
require 'json'

user = "ユーザID"
pass = "パスワード"
url = "https://#{user}:#{pass}@stream.watsonplatform.net/text-to-speech/api/v1/synthesize"
accept = "audio/wav"
voice = "ja-JP_EmiVoice"
ifile = "input.json"
ofile = "output.wav"

json = JSON.load(File.open(ifile).read).to_json
res = RestClient.post url, json, {content_type: :json, accept: accept, params:{voice:voice}}

IO.write(ofile,res.body)
input.json
{ "text" : "これはTextToSpeechのRubyPOSTバージョンです。" }
johnslith
アイ アム リス
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away