lilypond-devel
[Top][All Lists]
Advanced

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

Chromatic transposition -- a very small starting step


From: Joseph Wakeling
Subject: Chromatic transposition -- a very small starting step
Date: Thu, 08 Jul 2010 20:47:28 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.10) Gecko/20100528 Thunderbird/3.0.5

Hello all,

As per earlier discussion on the -user list:
http://www.mail-archive.com/address@hidden/msg51183.html

... I finally managed to put some time and mental energy towards
chromatic transposition, in particular, the naturalizeMusic function
from the LSR.

I've attached a draft version that makes two changes to the original:

    (1) it takes out the original's focus on quarter-tones as the
        units of alteration, and changes the conditions for rewriting
        so that it will let pass any alteration less than a whole tone
        (so e.g. 3/4-flats and sharps will not be rewritten; but see
        below for caveat ...)

    (2) it introduces a (do ...) loop to make sure that the process of
        naturalization converges.  This way you don't get accidental
        (pun intended:-) double-flats hanging around due to weird
        transpositions.

        (Example: take the music of bb. 9-10 in the sample music, and
        put it through the _original_ naturalizeMusic function.  You get
        left with a g-double-flat instead of an f-natural.)

What I still would like to do is make optional the question of the
largest alteration permitted.  See lines 15--17 of the code:

     (cond
      ((>= a 1) (set! a (- a 1)) (set! n (+ n 1)))
      ((<= a -1) (set! a (+ a 1)) (set! n (- n 1))))

In the original naturalizeMusic function, these conditional statements
were the equivalent of (> a (/ 1 2)) and (< a (/ -1 2)), which rewrote
any alteration larger than a semitone.

As Hans Aberg pointed out, this can be important for e.g. harp music
where there is a strict limit of +/- 1/2-tone on note alterations.

The best way to achieve this seems to be to make those conditions
variables in the function definition, something like,

 (define (naturalize-pitch p toohigh toolow)

     ...

     (cond
      ((toohigh a) (set! a (- a 1)) (set! n (+ n 1)))
      ((toolow a) (set! a (+ a 1)) (set! n (- n 1))))

... with toohigh or toolow being defined to give both a predicate (>,
>=, <, <=) and a value (1, -1, (/ 1 2), (/ -1 2) ...)

I'm shaky on how to define toohigh or twolow, though (not so much a
schemer as a meddler): can someone advise?

Thanks & best wishes,

    -- Joe

Attachment: naturalizeMusicModern.ly
Description: Text document


reply via email to

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