comparison yeti/cqt.yeti @ 41:ae7d2e558ed1

More debug testing
author Chris Cannam <c.cannam@qmul.ac.uk>
date Tue, 19 Nov 2013 19:27:45 +0000
parents 031386846e3c
children 53d1e0d59ac5
comparison
equal deleted inserted replaced
40:031386846e3c 41:ae7d2e558ed1
15 cqt { maxFreq, minFreq, binsPerOctave } str = 15 cqt { maxFreq, minFreq, binsPerOctave } str =
16 (sampleRate = str.sampleRate; 16 (sampleRate = str.sampleRate;
17 octaves = ceil (log2 (maxFreq / minFreq)); 17 octaves = ceil (log2 (maxFreq / minFreq));
18 actualMinFreq = (maxFreq / (pow 2 octaves)) * (pow 2 (1/binsPerOctave)); 18 actualMinFreq = (maxFreq / (pow 2 octaves)) * (pow 2 (1/binsPerOctave));
19 19
20 eprintln "sampleRate = \(sampleRate), maxFreq = \(maxFreq), minFreq = \(minFreq), actualMinFreq = \(actualMinFreq), octaves = \(octaves), binsPerOctave = \(binsPerOctave)"; 20 kdata = cqtkernel.makeKernel { sampleRate, maxFreq, binsPerOctave };
21 21
22 kdata = cqtkernel.makeKernel { sampleRate, maxFreq, binsPerOctave }; 22 eprintln "sampleRate = \(sampleRate), maxFreq = \(maxFreq), minFreq = \(minFreq), actualMinFreq = \(actualMinFreq), octaves = \(octaves), binsPerOctave = \(binsPerOctave), fftSize = \(kdata.fftSize), hop = \(kdata.fftHop)";
23 23
24 eprintln "atomsPerFrame = \(kdata.atomsPerFrame)"; 24 eprintln "atomsPerFrame = \(kdata.atomsPerFrame)";
25 25
26 padding = (kdata.fftSize / 2) * (pow 2 (octaves-1)); 26 padding = (kdata.fftSize * (pow 2 (octaves-1)));
27 27
28 eprintln "padding = \(padding)"; 28 eprintln "padding = \(padding)";
29 29
30 str = manipulate.paddedBy padding str; 30 str = manipulate.paddedBy padding str;
31 31
43 frames = framer.monoFrames //!!! mono for now 43 frames = framer.monoFrames //!!! mono for now
44 { framesize = kdata.fftSize, hop = kdata.fftHop } 44 { framesize = kdata.fftSize, hop = kdata.fftHop }
45 (resample.decimated (pow 2 octave) streams[octave]); 45 (resample.decimated (pow 2 octave) streams[octave]);
46 map do frame: 46 map do frame:
47 freq = fftFunc (cplx.complexArray frame (vec.zeros kdata.fftSize)); 47 freq = fftFunc (cplx.complexArray frame (vec.zeros kdata.fftSize));
48 println "octave = \(octave), frame = \(vec.list frame)";
49 println "octave = \(octave), freq = \(freq)";
48 cm.product kernel (cm.newComplexColumnVector freq); 50 cm.product kernel (cm.newComplexColumnVector freq);
49 done frames; 51 done frames;
50 done [0..octaves-1]; 52 done [0..octaves-1];
51 53
52 // The cqblocks list is a list<list<matrix>>. Each top-level list 54 // The cqblocks list is a list<list<matrix>>. Each top-level list
102 done cqblocks; 104 done cqblocks;
103 105
104 cqblocks = array (map2 do octlist octave: 106 cqblocks = array (map2 do octlist octave:
105 d = emptyHops * (pow 2 (octaves-octave)) - emptyHops; 107 d = emptyHops * (pow 2 (octaves-octave)) - emptyHops;
106 108
107 d = 0; //!!! 109 // d = 0; //!!!
108 110
109 eprintln "dropping \(d)"; 111 eprintln "dropping \(d)";
110 drop d octlist; 112 drop d octlist;
111 done cqblocks [1..octaves]); 113 done cqblocks [1..octaves]);
112 114