Music knowledge representation

Aaron "Castironpi" Brady castironpi at gmail.com
Sun Sep 28 14:59:41 EDT 2008


On Sep 28, 9:37 am, Mr.SpOOn <mr.spoo... at gmail.com> wrote:
> Hi,
> I'm working on an application to analyse music (melodies, chord sequences etc.)
>
> I need classes to represent different musical entities. I'm using a
> class Note to represent all the notes. Inside it stores the name of
> the natural version of the note (C, D, E, F...) and an integer to
> calculate the accidentals.
>
> Then I have a class Pitch, to represent the different 12 pitch
> classes, because different notes, such as C# and Db, belong to the
> same pitch class.
>
> In these classes I also have some arithmetic method to perform
> additions or subtractions between pitches and integers.
>
> I also need to represent intervals between notes. An interval must
> have a degree (first, second, third), that may be represented with a
> simple integer and a size counted in semitones. Then, with these
> informations it can retrieve its name, for example: perfect fifth.
>
> The degree is calculated between natural notes. So the degree of
> Interval(C, E) is "third", or 3. This may be simple, if I put the
> notes in an ordered sequence. But, when I have to calculate, for
> example Interval(E, C). It should count till the end of the sequence,
> so if I have:
>
> C D E F G A B
>
> after the B it should continue with C. I'm not sure how to implement
> this. Is there a suitable data structure for this purpose?

Hi,

Here is a link to someone else's design they asked about on the
newsgroup a couple weeks ago.

http://groups.google.com/group/comp.lang.python/browse_thread/thread/ecffaa827984866d/921cba3084b984dc?lnk=st&q=sharpnote#921cba3084b984dc



More information about the Python-list mailing list