Partial match of a sequence

19 views
Skip to first unread message

Mr.SpOOn

unread,
Dec 13, 2009, 4:53:01 PM12/13/09
to py...@googlegroups.com
Hi,
sorry if the object is not very clear, but I didn't know how to call this.

The problem is this: given some notes I want to find the tonality or
one or more scales they may belong to.

There are different types of scales and they are formed by seven intervals.

major scale: 1 2 3 4 5 6 7
minor scale: 1 2 b3 4 5 b6 7
and so on...

To check if a set of notes may belong to a scale I choose a note as
the root and then calculate intervals in relation to this note.
For example, if I have this three notes: C, E, A
I can start saying that C is the root. So C with C is a "first" (1), C
with E is a "major third" (3), C with G is a "fifth" (5).
Then I can do the same using E as root. So E with C is a sixth and
also the other intervals are different.

So from the notes I have a set of intervals which I want to match with
the scales. Given these intervals (1, 3, 5) I would like to get all
the scales that have these interlvas. In this case the major scales
have them, the minor scale no.
How can I do shuch a thing?

The only solution I'm trying to implement is really complex and I
don't like it very much. For every note I have I create a scale. For
example, I start with the major scale, so I create a C major scale, a
E major scale and a G major scale.

The C major scale is:
C D E F G A B

Now, since I had these notes: C, E, G
I see that C and E is a third, so I compare the third I have (E) with
the third in the scale I have generated. If they are the same I go on
with the next note. And so on. It should work, but since there are
going to be a lot of scales this method will take too much time, I
think. And it doesn't seem very clever.

I hope it is clear what I'm trying to do.

Thanks,
Carlo

Bruce Frederiksen

unread,
Dec 13, 2009, 8:23:13 PM12/13/09
to py...@googlegroups.com
Hi Carlo,

As I understand your question, you are able to convert C, E, A to a set of intervals but want to know how to find the scales that include these intervals.  I would use Python's set capabilities:

scale_with_intervals
    use scale_with_intervals($name, $intervals)
    when
        scale($name, $scale_intervals)
        check set($scale_intervals).issuperset($intervals)

This will succeed for each scale that includes the intervals.  The scale facts would look like:

scale(major_scale, (1, 2, 3, 4, 5, 6, 7))

Does this answer your question?

-Bruce



--

You received this message because you are subscribed to the Google Groups "PyKE" group.
To post to this group, send email to py...@googlegroups.com.
To unsubscribe from this group, send email to pyke+uns...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pyke?hl=en.



Mr.SpOOn

unread,
Dec 14, 2009, 4:37:55 AM12/14/09
to py...@googlegroups.com
2009/12/14 Bruce Frederiksen <dang...@gmail.com>:
>
> scale_with_intervals
>     use scale_with_intervals($name, $intervals)
>     when
>         scale($name, $scale_intervals)
>         check set($scale_intervals).issuperset($intervals)
>
> This will succeed for each scale that includes the intervals.  The scale
> facts would look like:
>
> scale(major_scale, (1, 2, 3, 4, 5, 6, 7))

This seems perfect. And so simple. I'll try as soon as possible.

Thanks,
Carlo
Reply all
Reply to author
Forward
0 new messages