Mercurial > hg > constant-q-cpp
view yeti/plotfile.yeti @ 112:a45b51ea00a2
Smaller range, faster chromagram
author | Chris Cannam <c.cannam@qmul.ac.uk> |
---|---|
date | Wed, 14 May 2014 14:59:45 +0100 |
parents | 872fc9dc0321 |
children |
line wrap: on
line source
program plotfile; af = load may.stream.audiofile; plot = load may.plot; cm = load may.matrix.complex; mat = load may.matrix; { cqt } = load cqt; minFreq = 27.5; maxRateDivisor = 3; binsPerOctave = 60; plotfile f = (testStream = af.open f; eprintln "Opened file stream..."; start = System#currentTimeMillis(); cq = cqt { maxFreq = testStream.sampleRate/maxRateDivisor, minFreq, binsPerOctave } testStream; middle = System#currentTimeMillis(); eprintln "Generated kernel \(cm.size cq.kernel.kernel) and primed transform (\(cq.octaves) octaves), took \(middle-start)ms, now calculating..."; bigM = mat.concatHorizontal cq.cqSpectrogram; finish = System#currentTimeMillis(); eprintln "Done, that part took \(finish-middle)ms, all CQ stuff took \(finish-start)ms"; eprintln "Plotting..."; \() (plot.plot [Contour bigM])); usage () = (eprintln "\nUsage: plotfile file.wav"; eprintln "\n Loads audio from file.wav and plots a \(binsPerOctave)bpo Constant-Q spectrogram"; eprintln " from \(minFreq)Hz up to 1/\(maxRateDivisor) of the file samplerate"); case (list _argv) of file::[]: plotfile file; _: usage (); esac;