Make a string of letters and numbers?

Basically, notes, chords and chords progression are imho a combination of enumerations I'd go for this : First, an enum of Note. It's far more easier to think in terms of semi-tones instead of notes enum Note { C (1), C# (2), D (3), D# (4), E (5), F (6), F# (7), G (8), G# (8), A (9), A# (10), B (11)} with the implementation of Note.ordinal() as suggested by mishaddof Second, i'll have a Chord enum containing all possible Chord Type, that gives the offset of the semi-tones to add to the root note. For a exemple : enum Chord { MAJOR(4, 7), MINOR (3, 6)} Finding CMaj is as simple as getting the C Note and getting the Notes that lies 4 (E) and 7 (G) semi-tones further in the Note enum.

For G#Maj(8), its C(8+4 =12(-11)=1 then D# (8+7=15-11=4). For Dmin, D(3),F(3+3 =6) and A#(3+7=9).

Basically, notes, chords and chords progression are imho a combination of enumerations. I'd go for this : First, an enum of Note. It's far more easier to think in terms of semi-tones instead of notes.

Enum Note { C (1), C# (2), D (3), D# (4), E (5), F (6), F# (7), G (8), G# (8), A (9), A# (10), B (11)} with the implementation of Note.ordinal() as suggested by mishaddof Second, i'll have a Chord enum containing all possible Chord Type, that gives the offset of the semi-tones to add to the root note. For a exemple : enum Chord { MAJOR(4, 7), MINOR (3, 6)} Finding CMaj is as simple as getting the C Note and getting the Notes that lies 4 (E) and 7 (G) semi-tones further in the Note enum. For G#Maj(8), its C(8+4 =12(-11)=1 then D# (8+7=15-11=4).

For Dmin, D(3),F(3+3 =6) and A#(3+7=9).

If you need limited set of values and capability bind some parameters to these values, use Enums. My first look into this problem: enum Note { C, D, E, F, G, A, B } class Chord { List notes; } In that case notes list contains your notes for chord in insertion order. If you don't care about order and as I suppose chord can't contain similar notes, use Set for notes holder.

Also, if you need codes use Note.ordinal() that returns code of your note.

I would give you an upvote but I don't have the capability at the moment =p Thanks for the help, that gives me a good idea on how to do it. – ekaj Nov 1 at 12:51 Using a List of Notes, you'll have to manually define all notes per Chord, instead of computing them. Kind of "magic numbers", which are not so good :( – Olivier Nov 1 at 14:00 Sure, but no general way to compute chords, in any case we should define set of notes according to chord – mishadoff Nov 1 at 14:13.

This should be a comment, not an answer – JB Nizet Nov 1 at 12:43 you can use HashMap for this purpose.HashMap. In key you can pass C,E,G and in value you will pass the numeric values(int) which you want to set(w.r.t. Particular key) – SilentBomb Nov 1 at 12:46 @JBNizet ok sir I will keep in mind – SilentBomb Nov 1 at 12:47.

The goal of this program at first would be to represent guitar chords with letter names (Ex: CMaj = CEG) and there could be a few different types of chords (majors, minors, diminished, etc.) To make this the easiest, I think I'm going to start with a C major scale because in that there are no sharps or flats. My first chord would probably be a C major, which is the 1st, 3rd, and 5th of the scale ( C D E F G A B ). My question is, using strings and characters (or some other way, I'm kind of guessing), is there a way to represent C as String(?) C, where C=1, D=2, E=3,..etc. so that when the program inputs for a major chord, it requests the 1st, 3rd and fifth of the respective scale?

So basically the user picks the chord C Maj, which converts to 1, 3, 5, and then the scales are matched up and the program calls those 3 specific intervals of that scale. Any help would be appreciated, or a different way to think about this entirely. I still don't understand, using Olivers example, how to specify when I make a C major chord that I want the 1st, 3rd, and 5th value of the Scales enum.

I like the idea about using the semi-tones from C and building off each chord, but I couldn't figure out how to put the #s into the Scales class (illegal character).. So basically my question is how do I get the Chord class to get the scale degrees from the Scales class and plug it into the EnumTest class?

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions