ben

OMÜ , Bilgisayar Mühendisliği, 13'

17 Mayıs 2016 Salı

SpeechToText


Rails uygulamasında metni sese cevirmek için gem mevcut, her ne kadar türkçeyi çok iyi konuşamasada anlaşılır şekilde okuyabiliyor.

gemfile.rb

gem "espeak-ruby", require: "espeak"



Çalıştırmak istediğiniz controllerın methoduna:

methodun üstune:
  include ESpeak

methodun içine:

speech = Speech.new("Bir", :speed   => 200 ,:pitch   => 50  , voice: "tr")
    speech.speak
    speech = Speech.new("İKİ", :speed   => 200 ,:pitch   => 50  , voice: "tr")
    speech.speak
    speech = Speech.new("ÜÇ", :speed   => 200 ,:pitch   => 50  , voice: "tr")
    speech.speak
    speech = Speech.new("DÖRT", :speed   => 200 ,:pitch   => 50  , voice: "tr")
    speech.speak
    speech = Speech.new("BEŞ", :speed   => 200 ,:pitch   => 50  , voice: "tr")
    speech.speak
    speech = Speech.new("ALTI", :speed   => 200 ,:pitch   => 50  , voice: "tr")
    speech.speak
    speech = Speech.new("YEDİ", :speed   => 200 ,:pitch   => 50  , voice: "tr")
    speech.speak
    speech = Speech.new("SEKİZ", :speed   => 200 ,:pitch   => 50  , voice: "tr")
    speech.speak
    speech = Speech.new("DOKUZ", :speed   => 200 ,:pitch   => 50  , voice: "tr")
    speech.speak
    speech = Speech.new("MERHABA ESRA , HOŞ GELDİN", :speed   => 200 ,:pitch   => 50  , voice: "tr")
    speech.speak


Yada Tüm kelimeleri tek cumlede yazabiliriz

    speech = Speech.new("ON, DOKUZ, SEKİZ, YEDİ, ALTI, BEŞ, DÖRT, ÜÇ, İKİ, BİR, SIFIR, MERHABA ESRA , HOŞ GELDİN", :speed   => 200 ,:pitch   => 50  , voice: "tr")
    speech.speak



Oluşturduğumuz ses dosyasını kaydedebiliriz:

    speech.save("speech.mp3")

Oluşan ses dosyası

Hiç yorum yok: