Mercurial > hg > constant-q-cpp
annotate misc/yeti/plotfile.yeti @ 178:2420733abeb6
Merge
author | Chris Cannam <c.cannam@qmul.ac.uk> |
---|---|
date | Fri, 17 Jul 2015 15:49:42 +0100 |
parents | 6deec2a51d13 |
children |
rev | line source |
---|---|
c@116 | 1 |
c@116 | 2 program plotfile; |
c@116 | 3 |
c@116 | 4 af = load may.stream.audiofile; |
c@116 | 5 plot = load may.plot; |
c@116 | 6 cm = load may.matrix.complex; |
c@116 | 7 mat = load may.matrix; |
c@116 | 8 |
c@116 | 9 { cqt } = load cqt; |
c@116 | 10 |
c@116 | 11 minFreq = 27.5; |
c@116 | 12 maxRateDivisor = 3; |
c@116 | 13 binsPerOctave = 60; |
c@116 | 14 |
c@116 | 15 plotfile f = |
c@116 | 16 (testStream = af.open f; |
c@116 | 17 eprintln "Opened file stream..."; |
c@116 | 18 start = System#currentTimeMillis(); |
c@116 | 19 cq = cqt { |
c@116 | 20 maxFreq = testStream.sampleRate/maxRateDivisor, |
c@116 | 21 minFreq, |
c@116 | 22 binsPerOctave |
c@116 | 23 } testStream; |
c@116 | 24 middle = System#currentTimeMillis(); |
c@116 | 25 eprintln "Generated kernel \(cm.size cq.kernel.kernel) and primed transform (\(cq.octaves) octaves), took \(middle-start)ms, now calculating..."; |
c@116 | 26 bigM = mat.concatHorizontal cq.cqSpectrogram; |
c@116 | 27 finish = System#currentTimeMillis(); |
c@116 | 28 eprintln "Done, that part took \(finish-middle)ms, all CQ stuff took \(finish-start)ms"; |
c@116 | 29 eprintln "Plotting..."; |
c@116 | 30 \() (plot.plot [Contour bigM])); |
c@116 | 31 |
c@116 | 32 usage () = |
c@116 | 33 (eprintln "\nUsage: plotfile file.wav"; |
c@116 | 34 eprintln "\n Loads audio from file.wav and plots a \(binsPerOctave)bpo Constant-Q spectrogram"; |
c@116 | 35 eprintln " from \(minFreq)Hz up to 1/\(maxRateDivisor) of the file samplerate"); |
c@116 | 36 |
c@116 | 37 case (list _argv) of |
c@116 | 38 file::[]: plotfile file; |
c@116 | 39 _: usage (); |
c@116 | 40 esac; |
c@116 | 41 |