Mercurial > hg > constant-q-cpp
changeset 66:3d165bf186f1
Add little program to plot cq of an audio file
author | Chris Cannam <c.cannam@qmul.ac.uk> |
---|---|
date | Fri, 14 Feb 2014 14:24:37 +0000 |
parents | bb1799a6d690 |
children | d6dd6e1cc00e |
files | yeti/plotfile.yeti yeti/test.yeti |
diffstat | 2 files changed, 33 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yeti/plotfile.yeti Fri Feb 14 14:24:37 2014 +0000 @@ -0,0 +1,33 @@ + +program plotfile; + +af = load may.stream.audiofile; +plot = load may.plot; +cm = load may.matrix.complex; +mat = load may.matrix; + +{ cqt } = load cqt; + +plotfile f = + (testStream = af.open f; + eprintln "Opened file stream..."; + cq = cqt { + maxFreq = testStream.sampleRate/2, + minFreq = 50, + binsPerOctave = 24 + } testStream; + eprintln "Generated kernel and primed transform, now calculating..."; + bigM = mat.concatHorizontal (map cm.magnitudes cq.output); + eprintln "Plotting..."; + \() (plot.plot [Contour bigM])); + +usage () = + (eprintln "\nUsage: plotfile file.wav"; + eprintln "\n Loads audio from file.wav and plots a 24bpo Constant-Q spectrogram"; + eprintln " from 50Hz up to half the file samplerate"); + +case (list _argv) of +file::[]: plotfile file; +_: usage (); +esac; +
--- a/yeti/test.yeti Fri Feb 14 11:55:03 2014 +0000 +++ b/yeti/test.yeti Fri Feb 14 14:24:37 2014 +0000 @@ -1,22 +1,8 @@ program test; -/* -af = load may.stream.audiofile; -plot = load may.plot; -cm = load may.matrix.complex; -mat = load may.matrix; -vec = load may.vector; -win = load may.signal.window; -mm = load may.mathmisc; -manipulate = load may.stream.manipulate; -syn = load may.stream.syntheticstream; -*/ { runTests } = load may.test; -//{ makeKernel } = load cqtkernel; -//{ cqt } = load cqt; - // We want to test: // // Kernel design -- check size (number of bins, number of atoms);