Music knowledge representation

D'Arcy J.M. Cain darcy at druid.net
Mon Sep 29 16:56:08 EDT 2008


On Mon, 29 Sep 2008 20:29:44 +0200
"Mr.SpOOn" <mr.spoon21 at gmail.com> wrote:
> > Couldn't the note class simply have a list of all the notes and have a
> > simple method calculate the actual pitch?
> 
> That's not really how it works. There exists just 12 octave
> independent pitch classes. This means that there is a pitch class C
> with all possible Cs. There ambiguities with accidentals, because
> different named notes fall in the same pitch class. The difference is
> important for the musical theory, because C# and Db belongs to the
> same pitch class (actually they are the same note, they sounds
> completely identical -- because on the piano you play them pressing
> the same key), but in a scale they have a very different role.

Sure, they are enharmonically identical but in our tempered scale.
That's why my example showed it as (note, octave, accidental) rather
than a specific note.  It would differentiate between these.

> For example, the interval C F# is an "augmented fourth", because what
> really matters are the natural note (C and F), and their distance if
> 4. Then it is augmented due to the #-
> 
> But the interval C Gb (Gb is the same as F#) is a "diminished fifth".

This is true.  My simple example would not have dealt with this.  The
arguments would have to be the full tuple rather than the actual pitch.

> So I can't list all pitches.

You can but you can't store them as raw pitches.

> >    def interval(self, lower, higher)
> >        if lower > higher:
> >            # uncomment one of the two following lines depending
> >            # on the behaviour you want
> >            #lower,higher = higher,lower
> >            #higher += 12
> >
> >        # could use some error trapping
> >        return self.interval_name[higher - lower]
> >
> > Note that lower and higher could be a note object that you have to
> > convert to integers first.
> 
> I can't estabilish which note is higher, because all the analysis part
> is octave independent. Anyway thanks for the ideas.

I'm not sure I understand this.  You either have to assume that the
first note is the root or the lower one is.  What other options are
there?  It sounds like your requirement is "higher += 12" or some
variant.  It also depends on whether you need to deal with things like
ninths and thirteenths.

Anyway, I was just tossing out ideas.  You know what your requirements
are better than I.

-- 
D'Arcy J.M. Cain <darcy at druid.net>         |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.



More information about the Python-list mailing list