# HG changeset patch # User Chris Cannam # Date 1383825310 0 # Node ID 7f0133234f0033c1e75a3d93799b26af7551b6d7 # Parent cb072f01435beb4d1063d62fd9ee67f6679dce7f Pull out test program diff -r cb072f01435b -r 7f0133234f00 yeti/cqt.yeti --- a/yeti/cqt.yeti Wed Nov 06 16:21:28 2013 +0000 +++ b/yeti/cqt.yeti Thu Nov 07 11:55:10 2013 +0000 @@ -1,33 +1,20 @@ -program cqt; +module cqt; cqtkernel = load cqtkernel; resample = load may.stream.resample; manipulate = load may.stream.manipulate; -syn = load may.stream.syntheticstream; cm = load may.matrix.complex; -mat = load may.matrix; framer = load may.stream.framer; cplx = load may.complex; fft = load may.transform.fft; vec = load may.vector; -af = load may.stream.audiofile; -plot = load may.plot; { pow, round, floor, ceil, log2, nextPowerOfTwo } = load may.mathmisc; -cqt str = +cqt { maxFreq, minFreq, binsPerOctave } str = (sampleRate = str.sampleRate; - maxFreq = sampleRate/2; - minFreq = 50; - binsPerOctave = 24; - -eprintln "Here"; - octaves = ceil (log2 (maxFreq / minFreq)); - -eprintln "Here: about to calculate stuff with \(octaves)"; - actualMinFreq = (maxFreq / (pow 2 octaves)) * (pow 2 (1/binsPerOctave)); eprintln "sampleRate = \(sampleRate), maxFreq = \(maxFreq), minFreq = \(minFreq), actualMinFreq = \(actualMinFreq), octaves = \(octaves), binsPerOctave = \(binsPerOctave)"; @@ -191,23 +178,5 @@ ); -//testStream = manipulate.withDuration 96000 (syn.sinusoid 48000 500); -//testStream = manipulate.withDuration 96000 (syn.pulseTrain 48000 4); -testStream = af.open "sweep-48000.wav"; -//testStream = af.open "sweep.wav"; +{ cqt } -eprintln "have test stream"; - -cq = cqt testStream; - -for cq do c: - mm = cm.magnitudes c; - for (mat.asColumns mm) (println . strJoin "," . vec.list); -done; - -bigM = mat.concatHorizontal (map cm.magnitudes cq); - -//\() (plot.plot [Contour bigM]); - -() - diff -r cb072f01435b -r 7f0133234f00 yeti/test.yeti --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yeti/test.yeti Thu Nov 07 11:55:10 2013 +0000 @@ -0,0 +1,35 @@ + +program test; + +af = load may.stream.audiofile; +plot = load may.plot; +cm = load may.matrix.complex; +mat = load may.matrix; +vec = load may.vector; +manipulate = load may.stream.manipulate; +syn = load may.stream.syntheticstream; + +{ cqt } = load cqt; + +//testStream = manipulate.withDuration 96000 (syn.sinusoid 48000 500); +//testStream = manipulate.withDuration 96000 (syn.pulseTrain 48000 4); +//testStream = af.open "sweep-48000.wav"; +//testStream = af.open "sweep.wav"; + +testStream = manipulate.withDuration 32 (syn.sinusoid 8 2); + +eprintln "have test stream"; + +cq = cqt { maxFreq = testStream.sampleRate/2, minFreq = 1, binsPerOctave = 24 } testStream; + +for cq do c: + mm = cm.magnitudes c; + for (mat.asColumns mm) (println . strJoin "," . vec.list); +done; + +bigM = mat.concatHorizontal (map cm.magnitudes cq); + +\() (plot.plot [Contour bigM]); + +() +