From af4979ef2d4c7683a2b927686beaca74ce789f91 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 6 Jul 2014 22:45:23 +0000 Subject: tests: hoist out pluck generation This allows the same sound to be reused in tests. --- test/helper.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test/helper.rb') diff --git a/test/helper.rb b/test/helper.rb index 1812e99..397d2c3 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -99,3 +99,11 @@ class Dir end end end unless Dir.respond_to?(:mktmpdir) + +def guitar_pluck(outfile) + outfile =~ %r{\A[\w\./-]+\z} or raise ArgumentError, "bad chars" + cmd = '(for n in E2 A2 D3 G3 B3 E4; do '\ + 'sox -n -ts32 -c2 -r44100 - synth 4 pluck $n; done ) | ' \ + "sox -ts32 -c2 -r44100 - #{outfile}" + assert_equal(true, system(cmd), cmd) +end -- cgit v1.2.3-24-ge0c7