Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/flite.rb

Instance Method Summary collapse

Instance Method Details

#speakObject

Speaks self

Examples:

"Hello Flite World!".speak


73
74
75
# File 'lib/flite.rb', line 73

def speak
  Flite.default_voice.speak(self)
end

#to_speech(audio_type = :wave, opts = {}) ⇒ String

Converts self to audio data.

Examples:

# Save speech as wav
File.binwrite('hello_flite_world.wav',
              'Hello Flite World!'.to_speech())

# Save speech as mp3
File.binwrite('hello_flite_world.mp3',
              'Hello Flite World!'to_speech(:mp3))

# Save speech as mp3 whose bitrate is 128k.
File.binwrite('hello_flite_world.mp3',
              'Hello Flite World!'.to_speech(:mp3, :bitrate => 128))

Parameters:

  • audo_type (Symbol)

    :wave or :mp3 (when mp3 support is enabled)

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

    audio encoder options

Returns:

See Also:



98
99
100
# File 'lib/flite.rb', line 98

def to_speech(*args)
  Flite.default_voice.to_speech(self, *args)
end