# HG changeset patch # User Chris Cannam # Date 1399890287 -3600 # Node ID 4d287bb157e4b12aa2211583f3acb77f27cd20c5 # Parent 4d08613cc9a2d33a8ddcbca8e78bef04a347ef63 Test that all convolution methods produce the same output for a longer stream diff -r 4d08613cc9a2 -r 4d287bb157e4 src/may/stream/test/test_convolve.yeti --- a/src/may/stream/test/test_convolve.yeti Mon May 12 11:24:24 2014 +0100 +++ b/src/may/stream/test/test_convolve.yeti Mon May 12 11:24:47 2014 +0100 @@ -130,6 +130,30 @@ done convolutionOptions); ), +"parameterInvariance": \( + // convolution by any method should give identical results + rate = 8000; + irlen = 500; + siglen = 1500; + ir = (syn.whiteNoise rate).read irlen; + params = [ + [ Fast true, Framesize 256 ], + [ Fast true, Framesize 512 ], + [ Fast false, Framesize 256 ], + [ Fast false, Framesize 512 ] + ]; + signals = manip.duplicated (length params) + (manip.withDuration siglen (syn.whiteNoise rate)); + convolved = map2 do s p: + mat.getRow 0 + ((convolve.convolvedWith p ir s).read (siglen + irlen - 1)); + done signals params; + diffs = map do c: + vec.max (vec.subtract c (head convolved)) + done convolved; + all id (map (compareUsing do a b: abs (a - b) < 1e-12 done (head diffs)) diffs); +), + ]); knowns = makeTests "known" false;