X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scm%2Fmodal-transforms.scm;h=98e9ac3021750bd510e9e9b276944820ab730fd4;hb=47db9a3883d726ca53e2133a3b2298f78dd6a32e;hp=9617329d77843a4e13777046cc86908be1edd44a;hpb=34fc5bf1293e0bbdea8519118112b50dd1256ac7;p=lilypond.git diff --git a/scm/modal-transforms.scm b/scm/modal-transforms.scm index 9617329d77..98e9ac3021 100644 --- a/scm/modal-transforms.scm +++ b/scm/modal-transforms.scm @@ -1,6 +1,6 @@ ;;; modal-transforms.scm --- Modal transposition, inversion, and retrograde. -;; Copyright (C) 2011--2012 Ellis & Grant, Inc. +;; Copyright (C) 2011--2015 Ellis & Grant, Inc. ;; Author: Michael Ellis @@ -48,11 +48,11 @@ pitches as members of a scale. (else (list-ref scale - (modulo - (+ (index pitch scale) - (- (index to-pitch scale) - (index from-pitch scale))) - (length scale))))))) + (modulo + (+ (index pitch scale) + (- (index to-pitch scale) + (index from-pitch scale))) + (length scale))))))) (define (inverter-factory scale) "Returns an inverter for the specified @var{scale}. @@ -81,11 +81,11 @@ arbitrary items and pitches as members of a scale. (else (list-ref scale - (modulo - (+ (index to-pitch scale) - (- (index around-pitch scale) - (index pitch scale))) - (length scale))))))) + (modulo + (+ (index to-pitch scale) + (- (index around-pitch scale) + (index pitch scale))) + (length scale))))))) (define (replicate-modify lis n mod-proc) "Apply @code{(mod-proc lis n)} to each element of a list and @@ -112,15 +112,15 @@ a single pitch as its argument and return a new pitch. These are LilyPond scheme pitches, e.g. @code{(ly:make-pitch 0 2 0)} " (let ((elements (ly:music-property music 'elements)) - (element (ly:music-property music 'element)) - (pitch (ly:music-property music 'pitch))) + (element (ly:music-property music 'element)) + (pitch (ly:music-property music 'pitch))) (cond ((ly:pitch? pitch) (ly:music-set-property! music 'pitch (converter pitch))) ((pair? elements) - (map (lambda (x) (change-pitches x converter)) elements)) + (for-each (lambda (x) (change-pitches x converter)) elements)) ((ly:music? element) (change-pitches element converter))))) @@ -130,13 +130,12 @@ LilyPond scheme pitches, e.g. @code{(ly:make-pitch 0 2 0)} "Recurse through @var{music}, extracting pitches. Returns a list of pitch objects, e.g @code{'((ly:make-pitch 0 2 0) (ly:make-pitch 0 4 0) ... )} -Typically used to construct a scale for input to transposer-factory -(see). -" +Typically used to construct a scale for input to +@code{transposer-factory}." (let ((elements (ly:music-property music 'elements)) - (element (ly:music-property music 'element)) - (pitch (ly:music-property music 'pitch))) + (element (ly:music-property music 'element)) + (pitch (ly:music-property music 'pitch))) (cond ((ly:pitch? pitch) @@ -159,10 +158,10 @@ Typically used to construct a scale for input to transposer-factory (lambda (lis n) (map (lambda (i) - (ly:make-pitch - (+ (- n 6) (ly:pitch-octave i)) - (ly:pitch-notename i) - (ly:pitch-alteration i))) + (ly:make-pitch + (+ (- n 6) (ly:pitch-octave i)) + (ly:pitch-notename i) + (ly:pitch-alteration i))) lis))) (let ((scale (make-scale music))) @@ -192,12 +191,15 @@ Typically used to construct a scale for input to transposer-factory ;; inversion and retrograding. (let* ((elements (ly:music-property music 'elements)) + (arts (ly:music-property music 'articulations)) (reversed (reverse elements)) (element (ly:music-property music 'element)) (span-dir (ly:music-property music 'span-direction))) (ly:music-set-property! music 'elements reversed) + (for-each retrograde-music arts) + (if (ly:music? element) (ly:music-set-property! music 'element @@ -206,7 +208,7 @@ Typically used to construct a scale for input to transposer-factory (if (ly:dir? span-dir) (ly:music-set-property! music 'span-direction (- span-dir))) - (map retrograde-music reversed) + (for-each retrograde-music reversed) music)) @@ -215,11 +217,11 @@ Typically used to construct a scale for input to transposer-factory and transposes from @var{around} to @var{to}." (let ((p (ly:music-property music 'pitch))) (if (ly:pitch? p) - (ly:music-set-property! - music 'pitch - (ly:pitch-transpose to (ly:pitch-diff around p)))) + (ly:music-set-property! + music 'pitch + (ly:pitch-transpose to (ly:pitch-diff around p)))) music)) (define-public (music-invert around to music) "Applies pitch-invert to all pitches in @var{music}." - (music-map (lambda (x) (pitch-invert around to x)) music)) + (music-map (lambda (x) (pitch-invert around to x)) music))