comparison constant-q-cpp/misc/yeti/test_cqtkernel.yeti @ 366:5d0a2ebb4d17

Bring dependent libraries in to repo
author Chris Cannam
date Fri, 24 Jun 2016 14:47:45 +0100
parents
children
comparison
equal deleted inserted replaced
365:112766f4c34b 366:5d0a2ebb4d17
1 /*
2 Constant-Q library
3 Copyright (c) 2013-2014 Queen Mary, University of London
4
5 Permission is hereby granted, free of charge, to any person
6 obtaining a copy of this software and associated documentation
7 files (the "Software"), to deal in the Software without
8 restriction, including without limitation the rights to use, copy,
9 modify, merge, publish, distribute, sublicense, and/or sell copies
10 of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
12
13 The above copyright notice and this permission notice shall be
14 included in all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
20 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
21 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
24 Except as contained in this notice, the names of the Centre for
25 Digital Music; Queen Mary, University of London; and Chris Cannam
26 shall not be used in advertising or otherwise to promote the sale,
27 use or other dealings in this Software without prior written
28 authorization.
29 */
30
31 module test_cqtkernel;
32
33 cm = load may.matrix.complex;
34 mm = load may.mathmisc;
35
36 { compare, compareUsing } = load may.test;
37
38 { makeKernel } = load cqtkernel;
39
40 eps = 1e-7;
41
42 compareClose = compareUsing do a b: abs (a - b) < eps done;
43
44 [
45
46 "minimal": \(
47 k = makeKernel { sampleRate = 16, maxFreq = 8, binsPerOctave = 4 };
48 compare k.binsPerOctave 4 and
49 compare (cm.size k.kernel) {
50 rows = k.binsPerOctave * k.atomsPerFrame,
51 columns = k.fftSize
52 } and
53 compareClose k.maxFrequency 8 and
54 compareClose k.minFrequency (4 * (mm.pow 2 (1/4))) and
55 compare k.atomsPerFrame 5 and
56 compare k.fftSize 32 and
57 compare (length k.binFrequencies) k.binsPerOctave and
58 compareClose (head k.binFrequencies) k.minFrequency and
59 compareClose (head (reverse k.binFrequencies)) k.maxFrequency
60 ),
61
62 ] is hash<string, () -> boolean>
63