Class: IvonaSpeechCloud::Input::CreateSpeech
- Inherits:
-
Object
- Object
- IvonaSpeechCloud::Input::CreateSpeech
- Includes:
- CommonDefaults
- Defined in:
- lib/ivona_speech_cloud/input.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
-
#text ⇒ Object
Returns the value of attribute text.
Instance Method Summary collapse
- #codec ⇒ Object
-
#initialize(options) ⇒ CreateSpeech
constructor
A new instance of CreateSpeech.
- #paragraph_break ⇒ Object
- #params ⇒ Object
- #rate ⇒ Object
- #sample_rate ⇒ Object
- #sentence_break ⇒ Object
- #voice_name ⇒ Object
- #volume ⇒ Object
Methods included from CommonDefaults
Constructor Details
#initialize(options) ⇒ CreateSpeech
Returns a new instance of CreateSpeech.
33 34 35 36 |
# File 'lib/ivona_speech_cloud/input.rb', line 33 def initialize() @text = .first @options = .last.is_a?(Hash) ? .pop : {} end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
30 31 32 |
# File 'lib/ivona_speech_cloud/input.rb', line 30 def @options end |
#text ⇒ Object
Returns the value of attribute text.
30 31 32 |
# File 'lib/ivona_speech_cloud/input.rb', line 30 def text @text end |
Instance Method Details
#codec ⇒ Object
61 62 63 |
# File 'lib/ivona_speech_cloud/input.rb', line 61 def codec .fetch(:codec, DEFAULT[:codec]) end |
#paragraph_break ⇒ Object
81 82 83 |
# File 'lib/ivona_speech_cloud/input.rb', line 81 def paragraph_break .fetch(:paragraph_break, DEFAULT[:paragraph_break]) end |
#params ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/ivona_speech_cloud/input.rb', line 38 def params { "Input" => { "Data" => text }, "OutputFormat" => { "Codec" => codec, "SampleRate" => sample_rate, }, "Parameters" => { "Rate" => rate, "Volume" => volume, "SentenceBreak" => sentence_break, "ParagraphBreak" => paragraph_break }, "Voice" => { "Name" => voice_name, "Language" => language, "Gender" => gender } }.to_json end |
#rate ⇒ Object
69 70 71 |
# File 'lib/ivona_speech_cloud/input.rb', line 69 def rate .fetch(:rate, DEFAULT[:rate]) end |
#sample_rate ⇒ Object
65 66 67 |
# File 'lib/ivona_speech_cloud/input.rb', line 65 def sample_rate .fetch(:sample_rate, DEFAULT[:sample_rate]) end |
#sentence_break ⇒ Object
77 78 79 |
# File 'lib/ivona_speech_cloud/input.rb', line 77 def sentence_break .fetch(:sentence_break, DEFAULT[:sentence_break]) end |
#voice_name ⇒ Object
85 86 87 |
# File 'lib/ivona_speech_cloud/input.rb', line 85 def voice_name .fetch(:voice_name, DEFAULT[:voice_name]) end |
#volume ⇒ Object
73 74 75 |
# File 'lib/ivona_speech_cloud/input.rb', line 73 def volume .fetch(:volume, DEFAULT[:volume]) end |