speech-tools 2.4 (new formula)

Edinburgh Speech Tools, a library of general speech software

commit 0a395b441cbc4d8a051bafdfc88902eee59f1e89
Author: Ingmar Steiner <steiner@coli.uni-saarland.de>
Date:   Sat Jan 3 21:11:09 2015 +0100

    tweak code style in install block

commit c4c70778ef5c9417dedd28ce7bcf3cc721a0ee21
Author: Ingmar Steiner <steiner@coli.uni-saarland.de>
Date:   Sat Jan 3 01:24:10 2015 +0100

    tweak code style in tests

commit f2974e42ded102b41d6bcd01451313f5bdc633e7
Author: Ingmar Steiner <steiner@coli.uni-saarland.de>
Date:   Fri Jan 2 23:35:38 2015 +0100

    install all executables under main

    better than arbitrary cherry-picking...

commit c131c300cc166b7854927787032da5afb56b10df
Author: Ingmar Steiner <steiner@coli.uni-saarland.de>
Date:   Fri Jan 2 21:56:28 2015 +0100

    add some integration tests

commit 80e6815294310bdbc109feecf99e118e9da1dbd6
Author: Ingmar Steiner <steiner@coli.uni-saarland.de>
Date:   Tue Dec 30 21:52:04 2014 +0100

    speech-tools 2.4 (new formula)

    Edinburgh Speech Tools, a library of general speech software

Closes Homebrew/homebrew#35366.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
This commit is contained in:
Ingmar Steiner 2015-01-03 21:12:06 +01:00 committed by Mike McQuaid
parent f27d1ac8cb
commit cbf1fafcee

48
Formula/speech-tools.rb Normal file
View file

@ -0,0 +1,48 @@
class SpeechTools < Formula
homepage "http://festvox.org/docs/speech_tools-2.4.0/"
url "http://festvox.org/packed/festival/2.4/speech_tools-2.4-release.tar.gz"
sha1 "5b0ebd39bb7afa33e4093724a2123bdc62a6aebc"
def install
ENV.deparallelize
system "./configure"
system "make"
# install all executable files in "main" directory
bin.install Dir["main/*"].select { |f| File.file?(f) && File.executable?(f) }
end
test do
rate_hz = 16000
frequency_hz = 100
duration_secs = 5
basename = "sine"
txtfile = "#{basename}.txt"
wavfile = "#{basename}.wav"
ptcfile = "#{basename}.ptc"
File.open(txtfile, 'w') do |f|
scale = 2 ** 15 - 1
f.puts Array.new(duration_secs * rate_hz) { |i| (scale * Math.sin(frequency_hz * 2 * Math::PI * i / rate_hz)).to_i }
end
# convert to wav format using ch_wave
system "ch_wave", txtfile,
"-itype", "raw",
"-istype", "ascii",
"-f", rate_hz.to_s,
"-o", wavfile,
"-otype", "riff"
# pitch tracking to est format using pda
system "pda", wavfile,
"-shift", (1 / frequency_hz.to_f).to_s,
"-o", ptcfile,
"-otype", "est"
# extract one frame from the middle using ch_track, capturing stdout
pitch = `ch_track #{ptcfile} -from #{frequency_hz * duration_secs / 2} -to #{frequency_hz * duration_secs / 2}`.strip
# should be 100 (Hz)
assert_equal frequency_hz, pitch.to_i
end
end