Mercurial > hg > amuse
view utils/export.lisp @ 310:f99fd6a7bbfc
Add midi-db.
Ignore-this: c6f4fc32efa4453ddbdc478793eedd52
A basic implementation for working with MIDI files stored in the database.
It is a test case for `versioned' data, but only partially implemented at the moment.
darcs-hash:20100223152703-16a00-4388d2720907d777a1c6c6b3a010885ce0fe06a7.gz
author | j.forth <j.forth@gold.ac.uk> |
---|---|
date | Tue, 23 Feb 2010 15:27:03 +0000 |
parents | 6af1f19a4475 |
children |
line wrap: on
line source
(cl:in-package #:amuse-utils) (defun beats->seconds (composition &optional (stream t)) "Prints a table of beat timepoints in seconds." (loop for i from 0 to (timepoint (cut-off composition)) do (format stream "~A~C~F~%" i #\Tab (amuse-utils:beats-to-seconds (make-moment i) composition)))) (defun export-data-from-composition (function composition pathname) "Function that applies another function to a composition, witing the output to a file, e.g. use this to call beats->seconds." (with-open-file (stream pathname :direction :output :if-exists :supersede) (funcall function composition stream))) (defun export-data-from-dataset (dataset function pathname) "Same as above except that processes an entire amuse-dataset." (loop for composition-identifier in (%list-slot-sequence-data dataset) do (with-open-file (stream (concatenate 'string pathname (princ-to-string (composition-id composition-identifier))) :direction :output :if-exists :supersede) (funcall function (get-composition composition-identifier) stream))))