annotate utils/export.lisp @ 330:2fbff655ba47 tip

Removed cpitch-adj and cents SQL columns
author Jeremy Gow <jeremy.gow@gmail.com>
date Mon, 21 Jan 2013 11:08:11 +0000
parents 6af1f19a4475
children
rev   line source
j@290 1 (cl:in-package #:amuse-utils)
j@290 2
j@290 3 (defun beats->seconds (composition &optional (stream t))
j@290 4 "Prints a table of beat timepoints in seconds."
j@290 5 (loop for i from 0 to (timepoint (cut-off composition))
j@290 6 do (format stream
j@290 7 "~A~C~F~%" i #\Tab
j@290 8 (amuse-utils:beats-to-seconds
j@290 9 (make-moment i) composition))))
j@290 10
j@290 11 (defun export-data-from-composition (function composition pathname)
j@290 12 "Function that applies another function to a composition, witing
j@290 13 the output to a file, e.g. use this to call beats->seconds."
j@290 14 (with-open-file (stream pathname
j@290 15 :direction :output
j@290 16 :if-exists :supersede)
j@290 17 (funcall function composition stream)))
j@290 18
j@290 19 (defun export-data-from-dataset (dataset function pathname)
j@290 20 "Same as above except that processes an entire amuse-dataset."
j@290 21 (loop for composition-identifier in
j@290 22 (%list-slot-sequence-data dataset)
j@290 23 do (with-open-file (stream
j@290 24 (concatenate 'string pathname
j@290 25 (princ-to-string
j@290 26 (composition-id
j@290 27 composition-identifier)))
j@290 28 :direction :output
j@290 29 :if-exists :supersede)
j@290 30 (funcall function
j@290 31 (get-composition composition-identifier) stream))))