changeset 82:24ff66e793fd

A bit more on icqt
author Chris Cannam <c.cannam@qmul.ac.uk>
date Tue, 29 Apr 2014 17:27:04 +0100
parents 788799487b1e
children 31a1271596c4
files yeti/icqt.yeti
diffstat 1 files changed, 17 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/yeti/icqt.yeti	Tue Apr 29 16:52:16 2014 +0100
+++ b/yeti/icqt.yeti	Tue Apr 29 17:27:04 2014 +0100
@@ -33,6 +33,7 @@
 cqt = load cqt;
 cm = load may.matrix.complex;
 mm = load may.mathmisc;
+vec = load may.vector;
 
 icqt cq =
    (kdata = cq.kernel;
@@ -52,6 +53,7 @@
     // and height kdata.binsPerOctave * cq.octaves.
 
     bpo = kdata.binsPerOctave;
+    atomsPerFrame = kdata.atomsPerFrame;
     octaves = cq.octaves;
 
     // transform a single block, all octaves tall, into an array
@@ -82,12 +84,25 @@
                             acc[oct] ++ chunk[oct]
                             done [0..octaves-1]))
                     rest;
-            _: [];
+            _: acc;
             esac;
         flattenAux (array (map \[] [0..octaves-1])) decomposed);
 
-    octaveColumnLists = flattenOctaves (map decomposeOctaves cq.cqComplex);
+    // given a list of columns, pile up each sequence of atomsPerFrame
+    // columns into a single tall column and return the resulting list
+    // of tall columns
+    pile cols =
+       (pileAux acc cols =
+            if (length cols) >= atomsPerFrame then
+                atoms = take atomsPerFrame cols;
+                pileAux (acc ++ [concat atoms]) (drop atomsPerFrame cols);
+            else
+                acc
+            fi;
+        pileAux [] cols);
 
+    octaveColumnLists = 
+        map pile (list (flattenOctaves (map decomposeOctaves cq.cqComplex)));
 
     for octaveColumnLists do l: println "octave column list length: \(length l)" done;