Eclectic I

Friday, March 02, 2007

CC Week 1 - Programming and Pseudocoding

Pseudocode for changing all major scales played on keyboard to harmonic minor scales.

Part 1 (I have only written the first 4 notes as the rest is obvious.)

IF MIDI note = 1
THEN play note C1

IF MIDI note = 2
THEN play note Csharp1

IF MIDI note = 3
THEN play note D1

IF MIDI note = 4
THEN play note Dsharp1

Part 2. (Ive only done the first 3 of these as the rest is obvious.)

IF notes C, D, E, F, G, A, B are pressed on keyboard
THEN DETERMINE as key of C

IF notes Csharp, Dsharp, Esharp, Fsharp, Gsharp, Asharp are pressed on keyboard
THEN DETERMIE as key of C# major

IF notes D, E, Fsharp, G, A, B, Csharp are pressed on keyboard
THEN DETERMINE as key of D major



Part 3.

DETERMINE KEY of notes being played on the keyboard

IF Notes pressed on keyboard are in the key of C THEN
sequence 1

ELSE

IF Notes pressed on keyboard are in the key of C sharp THEN
sequence 2

ELSE
IF Notes pressed on keyboard are in the key of D THEN
sequence 3

ELSE

IF Notes pressed on keyboard are in the key of D sharp THEN
sequence 4

ELSE

IF Notes pressed on keyboard are in the key of E THEN
sequence 5

ELSE

IF Notes pressed on keyboard are in the key of E sharp THEN
sequence 6

ELSE

IF Notes pressed on keyboard are in the key of F THEN
sequence 7

ELSE

IF Notes pressed on keyboard are in the key of F sharp THEN
sequence 8

ELSE

IF Notes pressed on keyboard are in the key of G THEN
sequence 9

ELSE

IF Notes pressed on keyboard are in the key of G sharp THEN
sequence 10

ELSE

IF Notes pressed on keyboard are in the key of A THEN
sequence 11

ELSE

IF Notes pressed on keyboard are in the key of A sharp THEN
sequence 12

ELSE

IF Notes pressed on keyboard are in the key of B THEN
sequence 13

ELSE

IF Notes pressed on keyboard are in the key of B sharp THEN
sequence 14

ELSE

IF Notes pressed on keyboard are in the key of C flat THEN
sequence 15

ELSE

IF Notes pressed on keyboard are in the key of D flat THEN
sequence 16

ELSE

IF Notes pressed on keyboard are in the key of E flat THEN
sequence 17

ELSE

IF Notes pressed on keyboard are in the key of F flat THEN
sequence 18

ELSE

IF Notes pressed on keyboard are in the key of G flat THEN
sequence 19

ELSE

IF Notes pressed on keyboard are in the key of A flat THEN
sequence 20

ELSE

IF Notes pressed on keyboard are in the key of B flat THEN
sequence 21

Part 4. (I have only written the first 4 sequences as I think its self explanitory that the rest of the sequences would continue to lower the third and sixth of each scale to make it harmonic minor.)

Sequence 1

WHILE notes pressed on keyboard are in key of C
FOR every E note pressed play the note E flat
FOR every A note pressed play the note A flat
REPEAT-UNTIL notes pressed on keyboard are no longer in key of C
THEN Begin again at DETERMINE KEY

Sequence 2

WHILE notes pressed on keyboard are in key of C sharp
FOR every F note pressed play the note E
FOR every B flat note pressed play the note A
REPEAT-UNTIL notes pressed on keyboard are no longer in key of C sharp
THEN Begin again at DETERMINE KEY

Sequence 3

WHILE notes pressed on keyboard are in key of D
FOR every F sharp note pressed play the note F
FOR every B note pressed play the note B flat
REPEAT-UNTIL notes pressed on keyboard are no longer in key of C
THEN Begin again at DETERMINE KEY

Sequence 4

WHILE notes pressed on keyboard are in key of D sharp
FOR every G note pressed play the note G Flat
FOR every C note pressed play the note B
REPEAT-UNTIL notes pressed on keyboard are no longer in key of C sharp
THEN Begin again at DETERMINE KEY

3 Comments:

Blogger Ben said...

Nah...

5:33 AM  
Blogger david j dowling said...

I prefer a semi-prolog approach:

Computer do this OR ELSE!

11:39 AM  
Blogger david j dowling said...

Or should that go:

THIS

OR

ELSE

!

11:41 AM  

Post a Comment

<< Home