diff options
| author | Ingmar Steiner | 2015-01-03 21:12:06 +0100 |
|---|---|---|
| committer | Mike McQuaid | 2015-01-04 10:36:30 +0000 |
| commit | 28a58f543ad762e75bf310d3546d68101b938e8f (patch) | |
| tree | d15deab47fc4f9a80c85557a60d84064c07d52d0 /Library | |
| parent | 0530a1a9f738bce974ad1f7002f89c44793182e9 (diff) | |
| download | homebrew-28a58f543ad762e75bf310d3546d68101b938e8f.tar.bz2 | |
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 #35366.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Formula/speech-tools.rb | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/Library/Formula/speech-tools.rb b/Library/Formula/speech-tools.rb new file mode 100644 index 000000000..d3ce4e890 --- /dev/null +++ b/Library/Formula/speech-tools.rb @@ -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 |
