]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/midi.scm
* python/rational.py: python 2.3 compat.
[lilypond.git] / scm / midi.scm
index 4180f1b517d294ce135e994c4d61ff0cd1fcd030..396a4a964511f56ded5703c75839432d059f3c61 100644 (file)
@@ -277,3 +277,24 @@ returns the program of the instrument
 (define-public (alterations-in-key pitch-list)
   "Count number of sharps minus number of flats"
   (/ (apply + (map cdr pitch-list)) 2))
+
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+
+(define-public (paper-book-write-midis paper-book basename)
+  (let
+      loop
+    ((perfs (ly:paper-book-performances paper-book))
+     (count 0))
+
+
+    (if (pair?  perfs)
+       (begin
+         (ly:performance-write
+          (car perfs)
+          (if (> count 0)
+              (format #f "~a-~a.midi" basename count)
+              (format #f "~a.midi" basename)))
+         (loop (cdr perfs) (1+ count))))))