[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Denemo-devel] began real transposition script
From: |
Richard Shann |
Subject: |
Re: [Denemo-devel] began real transposition script |
Date: |
Sat, 15 Nov 2008 14:58:24 +0000 |
On Sat, 2008-11-15 at 07:47 -0600, Jeremiah Benham wrote:
> On Sat, 2008-11-08 at 09:22 +0000, Richard Shann wrote:
> > On Fri, 2008-11-07 at 10:37 -0600, Jeremiah Benham wrote:
> > > I began writing a real transposition script
> > >
> > > (define chromatic_notes '(
> > > ("a" 0)
> > > ("b" 1)
> > > ("c" 2)
> > > ("d" 3)
> > > ("e" 4)
> > > ("f" 5)
> > > ("g" 6)))
> > >
> > > (define sharp_list (list "a" "ais" "b" "c" "cis" "d" "dis" "e" "f"
> > > "fis"
> > > "g" "gis"))
> > >
> > > (define transpose
> > > (lambda (note modulate)
> > > (list-ref sharp_list (+ modulate (car (cdr (assoc note
> > > chromatic_notes)))))))
> > >
> > >
> > > Am I on the right path with this.
> > I am not so sure that this is a good way to go. A transposition is not
> > defined by a single integer.
> > You need two, one would be the number of diatonic steps, the other
> > something to encode the number of additional sharps/flats.
> >
> > So c->cis would be (0, 7)
> > an augmented unison (that is going for example from C-major to C#-major)
> > c->cis'' would be (16, 7)
> > same plus two octaves
> > while
> > c->des would be (1, -5)
> > a minor second (going for example from C-major to Db-major)
> >
> > my guess is that someone will have sorted out a neat way of calculating
> > the amount to add/subtract to the enharmonic_shift for a given
> > transposition - a good place to look might be the LilyPond source
> > tarball.
>
> I have checked out the lilypond source of 1.6.5 where many things were
> written in scheme. I found the transposition function they use. I goes
> like this basically. Pitch data is stored like as a list like this:
> '(octave notename accidental)
>
> so ....
>
> '(0 0 0) = middle c
> '(0 0 1) = c#
> '(0 1 -1) = Db
>
> '(1 1 1) = D# an octave above middle c
>
> The transpose function is simple it adds the pitch values to a
> transposition amount.
>
> so ...
>
> '(0 0 0) + '(1 1 0) would raise middle c up a major 9th.
>
> They only thing I need to decide then would be what to do when the
> accidentals get larger then the absolute value of 2. Denemo only allows
> 2 accidentals. I am going to assume that they should be converted to
> their enharmonic equivalent?
Just report the error (there is no standard music convention for
denoting more than double sharp or double flat, at least that I had
heard of until I just looked on wikipedia!)
Glad to hear it's on the way
Richard
Re: [Denemo-devel] began real transposition script, Jeremiah Benham, 2008/11/08