O
outstretchedarm
I'm pretty noobish to javascript
I want to make algorithms that take selections from arrays and put them
together in new ways.
here is a simple array I set up for notes of a piano keyboard:
<html>
<body><script type="text/javascript">
var x
var note = new Array()
note[0] = "C"
note[1] = "Db"
note[2] = "D"
note[3] = "Eb"
note[4] = "E"
note[5] = "F"
note[6] = "Gb"
note[7] = "G"
note[8] = "Ab"
note[9] = "A"
note[10] = "Bb"
note[11] = "B"
for (x in note)
{
document.write(note[x] + "<br />")
}
</script></body>
</html>
what I want to do is:
1) enable the user to select a "starting note" (that is the key)
2) enable the user to select a scale, that is, a "path" through these
notes. If the user selects major, the program will, starting from the
selected starter note, choose thenext notes according to this pattern:
Root (the key selected) + 2 + 2 + 1 + 2 + 2 + 2 + 1
so if the user selects "C" and "major scale," it will print:
C, D, E, F, G, A, B, C
3) I want the program to "create" chords from the notes in the scale
generated.
like this:
I = 1 + 3 + 5 = C chord = C + E + G
II = 2 + 4 + 6 = D chord = D + F + A
III = 3 + 5 + 7 = E chord = E + G + B
IV = 4 + 6 + 1 = F chord = F + A + C
V = 5 + 7 + 2 = G chord = G + B + D
VI = 6 + 1 + 3 = A chord = A + C + E
VII= 7 + 2 + 4 = B chord = B + D + F
I need help with:
a) can somebody give me hints on how to code the algorithms that would
do this?
b) could somebody point me in the directions of a set of snippets that
might help me on this? Have mercy, I am a n00b, not begging for a
handout, but for help.
thanks
I want to make algorithms that take selections from arrays and put them
together in new ways.
here is a simple array I set up for notes of a piano keyboard:
<html>
<body><script type="text/javascript">
var x
var note = new Array()
note[0] = "C"
note[1] = "Db"
note[2] = "D"
note[3] = "Eb"
note[4] = "E"
note[5] = "F"
note[6] = "Gb"
note[7] = "G"
note[8] = "Ab"
note[9] = "A"
note[10] = "Bb"
note[11] = "B"
for (x in note)
{
document.write(note[x] + "<br />")
}
</script></body>
</html>
what I want to do is:
1) enable the user to select a "starting note" (that is the key)
2) enable the user to select a scale, that is, a "path" through these
notes. If the user selects major, the program will, starting from the
selected starter note, choose thenext notes according to this pattern:
Root (the key selected) + 2 + 2 + 1 + 2 + 2 + 2 + 1
so if the user selects "C" and "major scale," it will print:
C, D, E, F, G, A, B, C
3) I want the program to "create" chords from the notes in the scale
generated.
like this:
I = 1 + 3 + 5 = C chord = C + E + G
II = 2 + 4 + 6 = D chord = D + F + A
III = 3 + 5 + 7 = E chord = E + G + B
IV = 4 + 6 + 1 = F chord = F + A + C
V = 5 + 7 + 2 = G chord = G + B + D
VI = 6 + 1 + 3 = A chord = A + C + E
VII= 7 + 2 + 4 = B chord = B + D + F
I need help with:
a) can somebody give me hints on how to code the algorithms that would
do this?
b) could somebody point me in the directions of a set of snippets that
might help me on this? Have mercy, I am a n00b, not begging for a
handout, but for help.
thanks