c@116: c@116: program plotfile; c@116: c@116: af = load may.stream.audiofile; c@116: plot = load may.plot; c@116: cm = load may.matrix.complex; c@116: mat = load may.matrix; c@116: c@116: { cqt } = load cqt; c@116: c@116: minFreq = 27.5; c@116: maxRateDivisor = 3; c@116: binsPerOctave = 60; c@116: c@116: plotfile f = c@116: (testStream = af.open f; c@116: eprintln "Opened file stream..."; c@116: start = System#currentTimeMillis(); c@116: cq = cqt { c@116: maxFreq = testStream.sampleRate/maxRateDivisor, c@116: minFreq, c@116: binsPerOctave c@116: } testStream; c@116: middle = System#currentTimeMillis(); c@116: eprintln "Generated kernel \(cm.size cq.kernel.kernel) and primed transform (\(cq.octaves) octaves), took \(middle-start)ms, now calculating..."; c@116: bigM = mat.concatHorizontal cq.cqSpectrogram; c@116: finish = System#currentTimeMillis(); c@116: eprintln "Done, that part took \(finish-middle)ms, all CQ stuff took \(finish-start)ms"; c@116: eprintln "Plotting..."; c@116: \() (plot.plot [Contour bigM])); c@116: c@116: usage () = c@116: (eprintln "\nUsage: plotfile file.wav"; c@116: eprintln "\n Loads audio from file.wav and plots a \(binsPerOctave)bpo Constant-Q spectrogram"; c@116: eprintln " from \(minFreq)Hz up to 1/\(maxRateDivisor) of the file samplerate"); c@116: c@116: case (list _argv) of c@116: file::[]: plotfile file; c@116: _: usage (); c@116: esac; c@116: