Class: RubySpeech::SSML::Break

Inherits:
Element
  • Object
show all
Defined in:
lib/ruby_speech/ssml/break.rb

Overview

The break element is an empty element that controls the pausing or other prosodic boundaries between words. The use of the break element between any pair of words is optional. If the element is not present between words, the synthesis processor is expected to automatically determine a break based on the linguistic context. In practice, the break element is most often used to override the typical automatic behavior of a synthesis processor.

www.w3.org/TR/speech-synthesis/#S3.2.3

Constant Summary collapse

VALID_STRENGTHS =
[:none, :'x-weak', :weak, :medium, :strong, :'x-strong'].freeze

Instance Attribute Summary

Attributes included from GenericElement

#parent

Instance Method Summary collapse

Methods inherited from Element

module, namespace, root_element, #to_doc

Methods included from GenericElement

#+, #==, #base_uri, #base_uri=, #build, #children, #clone, #create_node, #embed, #eval_dsl_block, included, #inherit, #initialize, #inspect, #mass_assign, #method_missing, #namespace=, #namespace_href, #node, #nokogiri_children, #read_attr, #respond_to_missing?, #string, #to_s, #traverse, #version, #version=, #write_attr

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class RubySpeech::GenericElement

Instance Method Details

#<<(*args) ⇒ Object

Raises:



51
52
53
# File 'lib/ruby_speech/ssml/break.rb', line 51

def <<(*args)
  raise InvalidChildError, "A Break cannot contain children"
end

#eql?(o) ⇒ Boolean

Returns:

  • (Boolean)


55
56
57
# File 'lib/ruby_speech/ssml/break.rb', line 55

def eql?(o)
  super o, :strength, :time
end

#strengthSymbol

This attribute is used to indicate the strength of the prosodic break in the speech output. The value “none” indicates that no prosodic break boundary should be outputted, which can be used to prevent a prosodic break which the processor would otherwise produce. The other values indicate monotonically non-decreasing (conceptually increasing) break strength between words. The stronger boundaries are typically accompanied by pauses. “x-weak” and “x-strong” are mnemonics for “extra weak” and “extra strong”, respectively.

Returns:

  • (Symbol)


19
20
21
# File 'lib/ruby_speech/ssml/break.rb', line 19

def strength
  read_attr :strength, :to_sym
end

#strength=(s) ⇒ Object

Parameters:

  • the (Symbol)

    strength. Must be one of VALID_STRENGTHS

Raises:

  • (ArgumentError)


28
29
30
31
# File 'lib/ruby_speech/ssml/break.rb', line 28

def strength=(s)
  raise ArgumentError, "You must specify a valid strength (#{VALID_STRENGTHS.map(&:inspect).join ', '})" unless VALID_STRENGTHS.include? s
  self[:strength] = s
end

#timeFloat

Indicates the duration of a pause to be inserted in the output in seconds or milliseconds. It follows the time value format from the Cascading Style Sheets Level 2 Recommendation [CSS2], e.g. “250ms”, “3s”.

Returns:

  • (Float)


38
39
40
# File 'lib/ruby_speech/ssml/break.rb', line 38

def time
  get_time_attribute :time
end

#time=(t) ⇒ Object

Parameters:

  • t (Numeric)

    the time as a positive value in seconds



47
48
49
# File 'lib/ruby_speech/ssml/break.rb', line 47

def time=(t)
  set_time_attribute :time, t
end