lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Pentatonic Diatonic Transposition?


From: Michael Ellis
Subject: Re: Pentatonic Diatonic Transposition?
Date: Fri, 21 Jan 2011 14:34:04 -0500

On Fri, Jan 21, 2011 at 4:41 AM, Daniel <address@hidden> wrote:
> Any other ideas?
>

Hi Daniel,

Here's a partial, but very general solution that will modally
transpose within any scale (or any ordered set of pitches) of any
length using modulo arithmetic.  To make it usable in LilyPond, you'll
need to wrap it in one or music functions that can

1. Extract pitch names from  music as strings or, better yet as symbols.
2. Run the pitch names through a transposer created with the scheme
function below
3. Deal with octave issues so that your melodic outline is preserved.
This is probably the trickiest part.
4. Insert the modified pitches back into the music stream.

Cheers,
Mike

#(use-modules (srfi srfi-1))  %needed for list-index and list-ref

#(define (make-modal-transposer scale)
    ;; Returns a transposer  for the specified scale
    ;; Usage example:
    ;;    Create a transposer for C major pentatonic
    ;;    (define c-pent (make-modal-transposer '(c d e g a)))
    ;;
    ;;    Apply to sequence of pitch names,
    ;;    specifying the starting pitch of the desired mode as
    ;;    the first argument to the transposer.
    ;;    (c-pent  'd   '(c c e d a))    ==> '(d d g e c)

    (define (index item lis)
        (list-index (lambda (x) (equal? item x)) lis))

    (lambda (mode-pitch pitch-sequence)
        (if (not (member mode-pitch scale))
            (error "Transposition target pitch not in scale!"))
        (map
            (lambda (p)
                (if (not (member p scale))
                    (error "Sequence pitch not in scale!"))
                (list-ref scale
                    (modulo (+ (index p scale) (index mode-pitch scale))
                        (length scale))))

            pitch-sequence)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]