annotate yeti/cqtkernel.yeti @ 2:0106107cb972
Another minor few sums...
author |
Chris Cannam <c.cannam@qmul.ac.uk> |
date |
Thu, 24 Oct 2013 11:18:18 +0100 |
parents |
f5379a70fc37 |
children |
53711c07ae3f |
rev |
line source |
c@1
|
1
|
c@1
|
2 module cqtkernel;
|
c@1
|
3
|
c@2
|
4 { pow, round, floor, ceil, nextPowerOfTwo } = load may.mathmisc;
|
c@1
|
5
|
c@1
|
6 fs = 48000;
|
c@1
|
7
|
c@1
|
8 fmax = fs/2;
|
c@1
|
9
|
c@1
|
10 bins = 24;
|
c@1
|
11
|
c@1
|
12 q = 1;
|
c@1
|
13
|
c@1
|
14 atomHopFactor = 0.25;
|
c@1
|
15
|
c@1
|
16 thresh = 0.0005;
|
c@1
|
17
|
c@1
|
18 fmin = (fmax/2) * (pow 2 (1/bins));
|
c@1
|
19
|
c@1
|
20 bigQ = q / ((pow 2 (1/bins)) - 1);
|
c@1
|
21
|
c@1
|
22 nk_max = round(bigQ * fs / fmin);
|
c@1
|
23
|
c@1
|
24 nk_min = round(bigQ * fs / (fmin * (pow 2 ((bins-1)/bins))));
|
c@1
|
25
|
c@1
|
26 atomHop = round(nk_min * atomHopFactor);
|
c@1
|
27
|
c@1
|
28 first_center = atomHop * Math#ceil(Math#ceil(nk_max/2) / atomHop);
|
c@1
|
29
|
c@1
|
30 fftLen = nextPowerOfTwo (first_center + Math#ceil(nk_max/2));
|
c@1
|
31
|
c@1
|
32 println "fs = \(fs), fmax = \(fmax), bins = \(bins), q = \(q), atomHopFactor = \(atomHopFactor), thresh = \(thresh)";
|
c@1
|
33
|
c@1
|
34 println "fmin = \(fmin), bigQ = \(bigQ), nk_max = \(nk_max), nk_min = \(nk_min), atomHop = \(atomHop), first_center = \(first_center), fftLen = \(fftLen)";
|
c@1
|
35
|
c@2
|
36 winNr = floor((fftLen - ceil(nk_max/2) - first_center) / atomHop) + 1;
|
c@2
|
37
|
c@2
|
38 last_center = first_center + (winNr - 1) * atomHop;
|
c@2
|
39
|
c@2
|
40 fftHop = (last_center + atomHop) - first_center;
|
c@2
|
41
|
c@2
|
42 fftOverlap = ((fftLen - fftHop) / fftLen) * 100; // as % -- why? just for diagnostics?
|
c@2
|
43
|
c@2
|
44 println "winNr = \(winNr), last_center = \(last_center), fftHop = \(fftHop), fftOverlap = \(fftOverlap)%";
|
c@2
|
45
|
c@2
|
46
|
c@2
|
47
|
c@2
|
48
|
c@1
|
49 ();
|
c@1
|
50
|