X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scm%2Fmidi.scm;h=cf43d3af7592759e5f5887812a1b6f2667665ce1;hb=def21b306e2b8fa2d5630fab0878e9922e197f0c;hp=ca26e2dfb1780a4a61cd39dc419544a6ff5d997b;hpb=cc442d6c8d1564a78caac37b2ef0c8b9bdc76fbc;p=lilypond.git diff --git a/scm/midi.scm b/scm/midi.scm index ca26e2dfb1..cf43d3af75 100644 --- a/scm/midi.scm +++ b/scm/midi.scm @@ -2,7 +2,7 @@ ;;;; ;;;; source file of the GNU LilyPond music typesetter ;;;; -;;;; (c) 2000--2005 Jan Nieuwenhuizen +;;;; (c) 2000--2007 Jan Nieuwenhuizen @@ -28,7 +28,7 @@ ("pp" . 0.49) ("ppp" . 0.42) ("pppp" . 0.34) - ("ppppp" . 0.25) ) + ("ppppp" . 0.25) ) absolute-volume-alist)) @@ -276,4 +276,25 @@ 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)) + + (* (apply + (map cdr pitch-list)) 2)) + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; + +(define-public (write-performances-midis performances basename . rest) + (let ((midi-ext (ly:get-option 'midi-extension))) + (let + loop + ((perfs performances) + (count (if (null? rest) 0 (car rest)))) + (if (pair? perfs) + (begin + (ly:performance-write + (car perfs) + (if (> count 0) + (format #f "~a-~a.~a" basename count midi-ext) + (format #f "~a.~a" basename midi-ext))) + (loop (cdr perfs) (1+ count))))))