X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scm%2Fmidi.scm;h=68352456b2df41222e895df630968b7599d1cd4c;hb=0ed6c4f5d241424be86f34fda2cc298932cb37b0;hp=70a4d7c0b00cacbd0eaef4d40347e09f16861e26;hpb=55a36d7beef61098884e49d6b853ce3d7a79811a;p=lilypond.git diff --git a/scm/midi.scm b/scm/midi.scm index 70a4d7c0b0..68352456b2 100644 --- a/scm/midi.scm +++ b/scm/midi.scm @@ -2,7 +2,7 @@ ;;;; ;;;; source file of the GNU LilyPond music typesetter ;;;; -;;;; (c) 2000--2004 Jan Nieuwenhuizen +;;;; (c) 2000--2009 Jan Nieuwenhuizen @@ -18,17 +18,17 @@ '( ("sf" . 1.00) ("fffff" . 0.95) - ("ffff" . 0.91) - ("fff" . 0.81) - ("ff" . 0.71) - ("f" . 0.61) - ("mf" . 0.50) - ("mp" . 0.40) - ("p" . 0.30) - ("pp" . 0.20) - ("ppp" . 0.10) - ("pppp" . 0.08) - ("ppppp" . 0.05) + ("ffff" . 0.92) + ("fff" . 0.85) + ("ff" . 0.80) + ("f" . 0.75) + ("mf" . 0.68) + ("mp" . 0.61) + ("p" . 0.55) + ("pp" . 0.49) + ("ppp" . 0.42) + ("pppp" . 0.34) + ("ppppp" . 0.25) ) absolute-volume-alist)) @@ -56,7 +56,12 @@ ) instrument-equalizer-alist)) -;; (name . program+32768*(channel10 ? 1 : 0) ) +(define-public (default-instrument-equalizer s) + (let ((entry (assoc s instrument-equalizer-alist))) + (if entry + (cdr entry)))) + +;; (name . program+32768*(channel10 ? 1 : 0)) (define instrument-names-alist '()) (set! instrument-names-alist (append @@ -98,7 +103,7 @@ ("electric guitar (muted)" . ,(- 29 1)) ("overdriven guitar" . ,(- 30 1)) ("distorted guitar" . ,(- 31 1)) - ("guitar harmo(dinics" . ,(- 32 1)) + ("guitar harmonics" . ,(- 32 1)) ; (33-40 bass) ("acoustic bass" . ,(- 33 1)) @@ -249,11 +254,6 @@ ) instrument-names-alist)) -(define-public (default-instrument-equalizer s) - (let ((entry (assoc s instrument-equalizer-alist))) - (if entry - (cdr entry)))) - (define-public (percussion? instrument) " returns whether the instrument should use midi channel 9 @@ -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)))))))