# HG changeset patch # User Chris Cannam # Date 1383124012 0 # Node ID 310435497b76ae990fabb3c3152eafd464d80c5b # Parent 7f9a9af75d91233789dfaec9a71bfc253162db21 Print out results (to go to file to load into e.g. SV) diff -r 7f9a9af75d91 -r 310435497b76 yeti/cqt.yeti --- a/yeti/cqt.yeti Tue Oct 29 16:55:55 2013 +0000 +++ b/yeti/cqt.yeti Wed Oct 30 09:06:52 2013 +0000 @@ -1,5 +1,5 @@ -module cqt; +program cqt; cqtkernel = load cqtkernel; resample = load may.stream.resample; @@ -20,26 +20,26 @@ minFreq = 40; binsPerOctave = 24; -println "Here"; +eprintln "Here"; octaves = ceil (log2 (maxFreq / minFreq)); -println "Here: about to calculate stuff with \(octaves)"; +eprintln "Here: about to calculate stuff with \(octaves)"; actualMinFreq = (maxFreq / (pow 2 octaves)) * (pow 2 (1/binsPerOctave)); - println "sampleRate = \(sampleRate), maxFreq = \(maxFreq), minFreq = \(minFreq), actualMinFreq = \(actualMinFreq), octaves = \(octaves), binsPerOctave = \(binsPerOctave)"; + eprintln "sampleRate = \(sampleRate), maxFreq = \(maxFreq), minFreq = \(minFreq), actualMinFreq = \(actualMinFreq), octaves = \(octaves), binsPerOctave = \(binsPerOctave)"; kdata = cqtkernel.makeKernel { sampleRate, maxFreq, binsPerOctave }; - println "atomsPerFrame = \(kdata.atomsPerFrame)"; + eprintln "atomsPerFrame = \(kdata.atomsPerFrame)"; streams = manipulate.duplicated octaves str; //!!! can't be right! kernel = cm.transposed (cm.conjugateTransposed kdata.kernel); - println "have kernel"; + eprintln "have kernel"; fftFunc = fft.forward kdata.fftSize; @@ -98,7 +98,7 @@ done octlist done cqblocks; -//println "lengths per oct: \(map length cqblocks)"; +//eprintln "lengths per oct: \(map length cqblocks)"; // Slice each octave's blocks into a list of columns with zeros // interspersed. This doesn't look very elegant (?) @@ -106,8 +106,8 @@ cqblocks = map2 do octlist octave: concat (map do m: concat (map do col: -// col :: map \(cplx.zeros kdata.binsPerOctave) [1..pow 2 octave - 1] - map \col [0..pow 2 octave - 1] + col :: map \(cplx.zeros kdata.binsPerOctave) [1..pow 2 octave - 1] +// map \col [0..pow 2 octave - 1] done (cm.asColumns m)) done octlist) done cqblocks [0..octaves-1]; @@ -126,7 +126,7 @@ pileOf cqblocks []; -//println "lengths per oct: \(map length cqblocks)"; +//eprintln "lengths per oct: \(map length cqblocks)"; //cqblocks; @@ -134,9 +134,19 @@ testStream = manipulate.withDuration 96000 (syn.sinusoid 48000 500); -println "have test stream"; +eprintln "have test stream"; -cqt testStream; +c = cqt testStream; +thing = take 50 (drop 200 c); +m = cm.newComplexMatrix (ColumnMajor ()) thing; +mm = cm.magnitudes m; +for (mat.asColumns mm) (println . strJoin "," . vec.list); +() + + + + + diff -r 7f9a9af75d91 -r 310435497b76 yeti/cqtkernel.yeti --- a/yeti/cqtkernel.yeti Tue Oct 29 16:55:55 2013 +0000 +++ b/yeti/cqtkernel.yeti Wed Oct 30 09:06:52 2013 +0000 @@ -28,8 +28,8 @@ fftSize = nextPowerOfTwo (firstCentre + ceil (maxNK/2)); - println "sampleRate = \(sampleRate), maxFreq = \(maxFreq), binsPerOctave = \(binsPerOctave), q = \(q), atomHopFactor = \(atomHopFactor), thresh = \(thresh)"; - println "minFreq = \(minFreq), bigQ = \(bigQ), maxNK = \(maxNK), minNK = \(minNK), atomHop = \(atomHop), firstCentre = \(firstCentre), fftSize = \(fftSize)"; + eprintln "sampleRate = \(sampleRate), maxFreq = \(maxFreq), binsPerOctave = \(binsPerOctave), q = \(q), atomHopFactor = \(atomHopFactor), thresh = \(thresh)"; + eprintln "minFreq = \(minFreq), bigQ = \(bigQ), maxNK = \(maxNK), minNK = \(minNK), atomHop = \(atomHop), firstCentre = \(firstCentre), fftSize = \(fftSize)"; winNr = floor((fftSize - ceil(maxNK/2) - firstCentre) / atomHop) + 1; @@ -37,7 +37,7 @@ fftHop = (lastCentre + atomHop) - firstCentre; - println "winNr = \(winNr), lastCentre = \(lastCentre), fftHop = \(fftHop)"; + eprintln "winNr = \(winNr), lastCentre = \(lastCentre), fftHop = \(fftHop)"; fftFunc = fft.forward fftSize; @@ -88,7 +88,7 @@ (cm.scaled (1/fftSize) (cm.newComplexMatrix (RowMajor()) (concat kernels))); - println "density = \(cm.density kmat)"; + eprintln "density = \(cm.density kmat)"; // Normalisation