]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/music-functions.scm
Fix 763 Fretboards don't transpose properly
[lilypond.git] / scm / music-functions.scm
index bc1cadace77166f1a68bbe43144e2c913998758e..0263d498e94038890c7ce4a30af0e4561e03f5e1 100644 (file)
@@ -2,7 +2,7 @@
 ;;;;
 ;;;;  source file of the GNU LilyPond music typesetter
 ;;;; 
-;;;; (c) 1998--2008 Jan Nieuwenhuizen <janneke@gnu.org>
+;;;; (c) 1998--2009 Jan Nieuwenhuizen <janneke@gnu.org>
 ;;;;                 Han-Wen Nienhuys <hanwen@xs4all.nl>
 
 ;; (use-modules (ice-9 optargs)) 
@@ -479,17 +479,29 @@ of beat groupings "
     "Some standard subdivisions for time signatures."
     (let*
        ((key (cons num den))
-        (entry (assoc key '(((6 . 8) . (3 3))
-                        ((5 . 8) . (3 2))
-                        ((9 . 8) . (3 3 3))
-                        ((12 . 8) . (3 3 3 3))
-                        ((8 . 8) . (3 3 2))
-                        ))))
+        (entry (assoc key '(
+               ; Simple time signatures
+               (( 3 .  8) . (3))
+               (( 4 .  8) . (2 2))
+               ; Compound time signatures
+               (( 6 .  4) . (3 3))
+               (( 6 .  8) . (3 3))
+               (( 6 . 16) . (3 3))
+               (( 9 .  4) . (3 3 3))
+               (( 9 .  8) . (3 3 3))
+               (( 9 . 16) . (3 3 3))
+               ((12 .  4) . (3 3 3 3))
+               ((12 .  8) . (3 3 3 3))
+               ((12 . 16) . (3 3 3 3))
+               ; Some common irregular time signatures
+               (( 5 .  8) . (3 2))
+               (( 8 .  8) . (3 3 2))
+               ))))
 
       (if entry
          (cdr entry)
-         '())))    
-  
+         '())))
+
   (let* ((set1 (make-property-set 'timeSignatureFraction (cons num den)))
         (beat (ly:make-moment 1 den))
         (len  (ly:make-moment num den))
@@ -720,8 +732,10 @@ SkipEvent. Useful for extracting parts from crowded scores"
 
 
 
-(defmacro-public def-grace-function (start stop)
+(defmacro-public def-grace-function (start stop . docstring)
+  "Helper macro for defining grace music"
   `(define-music-function (parser location music) (ly:music?)
+     ,@docstring
      (make-music 'GraceMusic
                 'origin location
                 'element (make-music 'SequentialMusic
@@ -735,7 +749,7 @@ Syntax:
   (define-music-function (parser location arg1 arg2 ...) (arg1-type? arg2-type? ...)
     ...function body...)
 "
-  (if (and (pair? body) (pair? (car body)) (eqv? '_i (caar body)))
+(if (and (pair? body) (pair? (car body)) (eqv? '_i (caar body)))
       ;; When the music function definition contains a i10n doc string,
       ;; (_i "doc string"), keep the literal string only
       (let ((docstring (cadar body))
@@ -937,6 +951,16 @@ Syntax:
      (skip-as-needed x parser)
    )))
 
+;;;;;;;;;;
+;;; general purpose music functions
+
+(define (shift-octave pitch octave-shift)
+  (_i "Add @var{octave-shift} to the octave of @var{pitch}.")
+  (ly:make-pitch
+     (+ (ly:pitch-octave pitch) octave-shift)
+     (ly:pitch-notename pitch)
+     (ly:pitch-alteration pitch)))
+
 
 ;;;;;;;;;;;;;;;;;
 ;; lyrics