Class: OCI::AiSpeech::Models::TtsOracleSpeechSettings

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/ai_speech/models/tts_oracle_speech_settings.rb

Overview

Settings to use for generating speech with a model from ORACLE family.

Constant Summary collapse

TEXT_TYPE_ENUM =
[
  TEXT_TYPE_TEXT = 'TEXT'.freeze,
  TEXT_TYPE_SSML = 'SSML'.freeze
].freeze
OUTPUT_FORMAT_ENUM =
[
  OUTPUT_FORMAT_MP3 = 'MP3'.freeze,
  OUTPUT_FORMAT_OGG = 'OGG'.freeze,
  OUTPUT_FORMAT_PCM = 'PCM'.freeze,
  OUTPUT_FORMAT_JSON = 'JSON'.freeze
].freeze
SPEECH_MARK_TYPES_ENUM =
[
  SPEECH_MARK_TYPES_SENTENCE = 'SENTENCE'.freeze,
  SPEECH_MARK_TYPES_WORD = 'WORD'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ TtsOracleSpeechSettings

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash

Options Hash (attributes):

  • :text_type (String)

    The value to assign to the #text_type property

  • :sample_rate_in_hz (Integer)

    The value to assign to the #sample_rate_in_hz property

  • :output_format (String)

    The value to assign to the #output_format property

  • :speech_mark_types (Array<String>)

    The value to assign to the #speech_mark_types property



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/oci/ai_speech/models/tts_oracle_speech_settings.rb', line 93

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  self.text_type = attributes[:'textType'] if attributes[:'textType']
  self.text_type = "TEXT" if text_type.nil? && !attributes.key?(:'textType') # rubocop:disable Style/StringLiterals

  raise 'You cannot provide both :textType and :text_type' if attributes.key?(:'textType') && attributes.key?(:'text_type')

  self.text_type = attributes[:'text_type'] if attributes[:'text_type']
  self.text_type = "TEXT" if text_type.nil? && !attributes.key?(:'textType') && !attributes.key?(:'text_type') # rubocop:disable Style/StringLiterals

  self.sample_rate_in_hz = attributes[:'sampleRateInHz'] if attributes[:'sampleRateInHz']

  raise 'You cannot provide both :sampleRateInHz and :sample_rate_in_hz' if attributes.key?(:'sampleRateInHz') && attributes.key?(:'sample_rate_in_hz')

  self.sample_rate_in_hz = attributes[:'sample_rate_in_hz'] if attributes[:'sample_rate_in_hz']

  self.output_format = attributes[:'outputFormat'] if attributes[:'outputFormat']
  self.output_format = "PCM" if output_format.nil? && !attributes.key?(:'outputFormat') # rubocop:disable Style/StringLiterals

  raise 'You cannot provide both :outputFormat and :output_format' if attributes.key?(:'outputFormat') && attributes.key?(:'output_format')

  self.output_format = attributes[:'output_format'] if attributes[:'output_format']
  self.output_format = "PCM" if output_format.nil? && !attributes.key?(:'outputFormat') && !attributes.key?(:'output_format') # rubocop:disable Style/StringLiterals

  self.speech_mark_types = attributes[:'speechMarkTypes'] if attributes[:'speechMarkTypes']

  raise 'You cannot provide both :speechMarkTypes and :speech_mark_types' if attributes.key?(:'speechMarkTypes') && attributes.key?(:'speech_mark_types')

  self.speech_mark_types = attributes[:'speech_mark_types'] if attributes[:'speech_mark_types']
end

Instance Attribute Details

#output_formatString

The format of audio in which the user wants the audio to be in. The supported output formats are: - MP3 - OGG - PCM - JSON

Returns:

  • (String)


47
48
49
# File 'lib/oci/ai_speech/models/tts_oracle_speech_settings.rb', line 47

def output_format
  @output_format
end

#sample_rate_in_hzInteger

The sample rate of the generated audio. By default, the audio will be generated with speaker voice sample rate.

Returns:

  • (Integer)


38
39
40
# File 'lib/oci/ai_speech/models/tts_oracle_speech_settings.rb', line 38

def sample_rate_in_hz
  @sample_rate_in_hz
end

#speech_mark_typesArray<String>

The kind of time stamp markings the user wants for the audio. This property should be provided if outputFormat is json, otherwise it will be ignored. null value (i.e. no value is not specified) indicates no speech marking. The supported speech mark types are: - SENTENCE - WORD

Returns:

  • (Array<String>)


57
58
59
# File 'lib/oci/ai_speech/models/tts_oracle_speech_settings.rb', line 57

def speech_mark_types
  @speech_mark_types
end

#text_typeString

The format in which the input text has been supplied i.e., Text or SSML. The supported text types are: - TEXT - SSML

Returns:

  • (String)


33
34
35
# File 'lib/oci/ai_speech/models/tts_oracle_speech_settings.rb', line 33

def text_type
  @text_type
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



60
61
62
63
64
65
66
67
68
69
# File 'lib/oci/ai_speech/models/tts_oracle_speech_settings.rb', line 60

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'text_type': :'textType',
    'sample_rate_in_hz': :'sampleRateInHz',
    'output_format': :'outputFormat',
    'speech_mark_types': :'speechMarkTypes'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



72
73
74
75
76
77
78
79
80
81
# File 'lib/oci/ai_speech/models/tts_oracle_speech_settings.rb', line 72

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'text_type': :'String',
    'sample_rate_in_hz': :'Integer',
    'output_format': :'String',
    'speech_mark_types': :'Array<String>'
    # rubocop:enable Style/SymbolLiteral
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other (Object)

    the other object to be compared



166
167
168
169
170
171
172
173
174
# File 'lib/oci/ai_speech/models/tts_oracle_speech_settings.rb', line 166

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    text_type == other.text_type &&
    sample_rate_in_hz == other.sample_rate_in_hz &&
    output_format == other.output_format &&
    speech_mark_types == other.speech_mark_types
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
# File 'lib/oci/ai_speech/models/tts_oracle_speech_settings.rb', line 199

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)

  self.class.swagger_types.each_pair do |key, type|
    if type =~ /^Array<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        public_method("#{key}=").call(
          attributes[self.class.attribute_map[key]]
            .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
        )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      public_method("#{key}=").call(
        OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
      )
    end
    # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • other (Object)

    the other object to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


179
180
181
# File 'lib/oci/ai_speech/models/tts_oracle_speech_settings.rb', line 179

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



188
189
190
# File 'lib/oci/ai_speech/models/tts_oracle_speech_settings.rb', line 188

def hash
  [text_type, sample_rate_in_hz, output_format, speech_mark_types].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



232
233
234
235
236
237
238
239
240
241
# File 'lib/oci/ai_speech/models/tts_oracle_speech_settings.rb', line 232

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = public_method(attr).call
    next if value.nil? && !instance_variable_defined?("@#{attr}")

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



226
227
228
# File 'lib/oci/ai_speech/models/tts_oracle_speech_settings.rb', line 226

def to_s
  to_hash.to_s
end