Skip to content

Instantly share code, notes, and snippets.

@yawara
Created February 8, 2015 13:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yawara/30f0c96707c0e7323dd9 to your computer and use it in GitHub Desktop.
Save yawara/30f0c96707c0e7323dd9 to your computer and use it in GitHub Desktop.
Open JTalk for Homebrew
class HtsEngineApi < Formula
homepage "http://hts-engine.sourceforge.net/"
url "https://downloads.sourceforge.net/project/hts-engine/hts_engine%20API/hts_engine_API-1.09/hts_engine_API-1.09.tar.gz"
sha1 "1c264c2bd29c87f49ace2c5d2b2fcd6b5b44b12c"
def install
system "./configure", "--prefix=#{prefix}"
system "make", "install"
end
test do
system "#{bin}/hts_engine"
end
end
class OpenJtalk < Formula
homepage "http://open-jtalk.sourceforge.net/"
url "https://downloads.sourceforge.net/project/open-jtalk/Open%20JTalk/open_jtalk-1.08/open_jtalk-1.08.tar.gz"
sha1 "34749abce5f8263ebbe9843b92407f4f0a742c66"
depends_on "gcc" => :build
depends_on "hts-engine-api" => :build
resource "voice" do
url "http://downloads.sourceforge.net/project/open-jtalk/HTS%20voice/hts_voice_nitech_jp_atr503_m001-1.05/hts_voice_nitech_jp_atr503_m001-1.05.tar.gz"
sha1 "4298eaef57f86b7c502488aad2f95963da75f061"
end
resource "mei" do
url "http://downloads.sourceforge.net/project/mmdagent/MMDAgent_Example/MMDAgent_Example-1.4/MMDAgent_Example-1.4.zip"
sha1 "8e94593244c636bbe757eb848f1025a0111f4372"
end
def install
ENV['CC'] = "#{Formula["gcc"].opt_prefix}/bin/gcc-4.9"
ENV['CXX'] = "#{Formula["gcc"].opt_prefix}/bin/g++-4.9"
args = %W[
--with-hts-engine-header-path=#{Formula["hts-engine-api"].opt_prefix}/include
--with-hts-engine-library-path=#{Formula["hts-engine-api"].opt_prefix}/lib
--with-charset=UTF-8
--prefix=#{prefix}
]
system "./configure", *args
system "make", "install"
resource("voice").stage do
mkdir_p "#{prefix}/voice/m100"
cp_r Dir["*"], "#{prefix}/voice/m100"
end
resource("mei").stage do
cp_r "Voice/mei", "#{prefix}/voice"
end
end
test do
system "echo おーぷんじぇいとーくのインストールがかんりょうしました > sample.txt"
system bin/"open_jtalk",
"-x", "#{prefix}/dic",
"-m", "#{prefix}/voice/mei/mei_normal.htsvoice",
"-ow", "out.wav",
"sample.txt"
system "afplay", "out.wav"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment