c@1: c@1: module cqtkernel; c@1: c@2: { pow, round, floor, ceil, nextPowerOfTwo } = load may.mathmisc; c@1: c@1: fs = 48000; c@1: c@1: fmax = fs/2; c@1: c@1: bins = 24; c@1: c@1: q = 1; c@1: c@1: atomHopFactor = 0.25; c@1: c@1: thresh = 0.0005; c@1: c@1: fmin = (fmax/2) * (pow 2 (1/bins)); c@1: c@1: bigQ = q / ((pow 2 (1/bins)) - 1); c@1: c@1: nk_max = round(bigQ * fs / fmin); c@1: c@1: nk_min = round(bigQ * fs / (fmin * (pow 2 ((bins-1)/bins)))); c@1: c@1: atomHop = round(nk_min * atomHopFactor); c@1: c@1: first_center = atomHop * Math#ceil(Math#ceil(nk_max/2) / atomHop); c@1: c@1: fftLen = nextPowerOfTwo (first_center + Math#ceil(nk_max/2)); c@1: c@1: println "fs = \(fs), fmax = \(fmax), bins = \(bins), q = \(q), atomHopFactor = \(atomHopFactor), thresh = \(thresh)"; c@1: c@1: println "fmin = \(fmin), bigQ = \(bigQ), nk_max = \(nk_max), nk_min = \(nk_min), atomHop = \(atomHop), first_center = \(first_center), fftLen = \(fftLen)"; c@1: c@2: winNr = floor((fftLen - ceil(nk_max/2) - first_center) / atomHop) + 1; c@2: c@2: last_center = first_center + (winNr - 1) * atomHop; c@2: c@2: fftHop = (last_center + atomHop) - first_center; c@2: c@2: fftOverlap = ((fftLen - fftHop) / fftLen) * 100; // as % -- why? just for diagnostics? c@2: c@2: println "winNr = \(winNr), last_center = \(last_center), fftHop = \(fftHop), fftOverlap = \(fftOverlap)%"; c@2: c@2: c@2: c@2: c@1: (); c@1: