1 ;;; midi.scm -- scm midi variables and functions
3 ;;; source file of the GNU LilyPond music typesetter
5 ;;; (c) 2000--2001 Jan Nieuwenhuizen <janneke@gnu.org>
8 ;; define factor of total volume per dynamic marking
9 (define absolute-volume-alist '())
10 (set! absolute-volume-alist
27 absolute-volume-alist))
29 (define (default-dynamic-absolute-volume s)
30 (let ((entry (assoc s absolute-volume-alist)))
34 ;; define factors of total volume of minimum and maximum volume
35 (define instrument-equaliser-alist '())
36 (set! instrument-equaliser-alist
41 ("clarinet" . (0 . 0.7))
42 ("bassoon" . (0 . 0.6))
43 ("french horn" . (0.1 . 0.7))
44 ("trumpet" . (0.1 . 0.8))
45 ("timpani" . (0.2 . 0.9))
46 ("violin" . (0.2 . 1.0))
47 ("viola" . (0.1 . 0.7))
48 ("cello" . (0.2 . 0.8))
49 ("contrabass" . (0.2 . 0.8))
51 instrument-equaliser-alist))
53 (define (default-instrument-equaliser s)
54 (let ((entry (assoc s instrument-equaliser-alist)))
58 ;; 90 == 90/127 == 0.71 is supposed to be the default value
59 ;; urg: we should set this at start of track
60 (define dynamic-default-volume 0.71)
62 ;; Count number of sharps minus number of flats
63 (define (accidentals-in-key pitch-list)
64 (apply + (map cdr pitch-list)))
66 ;; Characterise the key as major if the alteration of the
67 ;; third scale note is the same as that of the main note
68 ;; Note: MIDI cannot handle other tonalities than major/minor.
69 (define (major-key pitch-list)
70 (eq? (cdr (list-ref pitch-list 4)) (cdr (list-ref pitch-list 6))))