Mercurial > hg > constant-q-cpp
view yeti/plotfile.yeti @ 75:f4fb0ac6120a
Interpolation for CQ. But this is wrong, it is interpolating between points in the nearest full-height columns even where there is a nearer point in the not-full-height ones
author | Chris Cannam <c.cannam@qmul.ac.uk> |
---|---|
date | Fri, 04 Apr 2014 11:49:53 +0100 |
parents | 642df7b3346f |
children | 872fc9dc0321 |
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 = case (cq.output (Spectrogram ())) of Real s: mat.concatHorizontal s; _: failWith "Real expected"; esac; 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;