c@116: /* c@116: Constant-Q library c@116: Copyright (c) 2013-2014 Queen Mary, University of London c@116: c@116: Permission is hereby granted, free of charge, to any person c@116: obtaining a copy of this software and associated documentation c@116: files (the "Software"), to deal in the Software without c@116: restriction, including without limitation the rights to use, copy, c@116: modify, merge, publish, distribute, sublicense, and/or sell copies c@116: of the Software, and to permit persons to whom the Software is c@116: furnished to do so, subject to the following conditions: c@116: c@116: The above copyright notice and this permission notice shall be c@116: included in all copies or substantial portions of the Software. c@116: c@116: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, c@116: EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF c@116: MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND c@116: NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY c@116: CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF c@116: CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION c@116: WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. c@116: c@116: Except as contained in this notice, the names of the Centre for c@116: Digital Music; Queen Mary, University of London; and Chris Cannam c@116: shall not be used in advertising or otherwise to promote the sale, c@116: use or other dealings in this Software without prior written c@116: authorization. c@116: */ c@116: c@116: module test_cqtkernel; c@116: c@116: cm = load may.matrix.complex; c@116: mm = load may.mathmisc; c@116: c@116: { compare, compareUsing } = load may.test; c@116: c@116: { makeKernel } = load cqtkernel; c@116: c@116: eps = 1e-7; c@116: c@116: compareClose = compareUsing do a b: abs (a - b) < eps done; c@116: c@116: [ c@116: c@116: "minimal": \( c@116: k = makeKernel { sampleRate = 16, maxFreq = 8, binsPerOctave = 4 }; c@116: compare k.binsPerOctave 4 and c@116: compare (cm.size k.kernel) { c@116: rows = k.binsPerOctave * k.atomsPerFrame, c@116: columns = k.fftSize c@116: } and c@116: compareClose k.maxFrequency 8 and c@116: compareClose k.minFrequency (4 * (mm.pow 2 (1/4))) and c@116: compare k.atomsPerFrame 5 and c@116: compare k.fftSize 32 and c@116: compare (length k.binFrequencies) k.binsPerOctave and c@116: compareClose (head k.binFrequencies) k.minFrequency and c@116: compareClose (head (reverse k.binFrequencies)) k.maxFrequency c@116: ), c@116: c@116: ] is hash boolean> c@116: