Sha256: cdc7a25a65f23f76776bbfbf0ef1bb4a4b916900d82a46bc225c3c711653db41

Contents?: true

Size: 520 Bytes

Versions: 6

Compression:

Stored size: 520 Bytes

Contents

#encoding: UTF-8
module Termit
  class SpeechSynthesizer
    def initialize options
      check_sound_player
      @text = options[:text]
      @url = Termit::UrlConstructor.new(options).url
    end

    def call
      response = Termit::DataFetcher.new(@url, @text).data
      Termit::SoundResponseHandler.new(response.body).call
    end

    private

    def check_sound_player
      unless system 'which mpg123 > /dev/null'
        raise "Termit speech synthesis requires mpg123 installed"
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
termit-2.0.5 lib/termit/speech_synthesizer.rb
termit-2.0.4 lib/termit/speech_synthesizer.rb
termit-2.0.3 lib/termit/speech_synthesizer.rb
termit-2.0.2 lib/termit/speech_synthesizer.rb
termit-2.0.1 lib/termit/speech_synthesizer.rb
termit-2.0.0 lib/termit/speech_synthesizer.rb