Esempio n. 1
0
        // Considering that the base chord is a coordinates (0,0), this method adds to the base note one fifth per +1 along X,
        // and flips the chord color for each value along Y, like so:
        // -1,1     0,1     1,1             Cm      Gm      Dm
        // -1,0     0,0     1,0             FM      CM      GM
        // -1,-1    0,-1    1,-1            Dm      Am      Em
        public Chord GetChordAtXY(int x, int y)
        {
            Note       n = baseNote;
            ChordColor c = color;

            byte tmp = baseNote.Octave;

            //Moving along the X axis: one fifth per column (one fifth = 7 semitones).
            n = n.Pitch(7 * x);

            //Moving along the Y axis: switch for the opposite color every row.
            //Considering any given row: the tone two rows above should be one second (2 semitones) below.
            //Considering any row of the original color: the tone one row below should be one minor third (3 semitones) below.
            if (y > 0)
            {
                int rowPairs = y / 2;
                n = n.PitchDown(rowPairs * 2);
                if (y % 2 == 1)
                {
                    n = n.PitchUp(7);
                    c = c.Opposite();
                }
            }
            else if (y < 0)
            {
                int rowPairs = (-y) / 2;
                n = n.PitchUp(rowPairs * 2);
                if (-y % 2 == 1)
                {
                    n = n.PitchDown(3);
                    c = c.Opposite();
                }
            }

            n.Octave = tmp;
            return(new Chord(n, c));
        }
Esempio n. 2
0
 public ChordScheme(Chord c)
 {
     baseNote = c.baseNote;
     color    = c.color;
 }
Esempio n. 3
0
 public ChordScheme()
 {
     baseNote = Note.DefaultNote;
     color    = ChordColor.Major;
 }
Esempio n. 4
0
 public ChordScheme(Note n, ChordColor c = ChordColor.Major)
 {
     baseNote = n;
     color    = c;
 }
Esempio n. 5
0
 public Chord(Note n, ChordColor c = ChordColor.Major)
 {
     baseNote = n;
     color    = c;
     init();
 }
Esempio n. 6
0
 public Chord(Chord c)
 {
     baseNote    = c.baseNote;
     color       = c.color;
     _collection = c._collection;
 }
Esempio n. 7
0
 public Chord()
 {
     baseNote = Note.DefaultNote;
     color    = ChordColor.Major;
     init();
 }
Esempio n. 8
0
 public MIDIChordSender(Note n, ChordColor c = ChordColor.Major)
 {
     baseChord = new Chord(n, c);
     init();
 }
Esempio n. 9
0
        public static ChordColor Opposite(this ChordColor c)
        {
            switch (c)
            {
            case ChordColor.Major:
                return(ChordColor.Minor);

            case ChordColor.Minor:
                return(ChordColor.Major);

            case ChordColor.Augmented:
                return(ChordColor.Diminished);

            case ChordColor.Diminished:
                return(ChordColor.Augmented);

            case ChordColor.FullAugmented:
                return(ChordColor.DiminishedSeventh);

            case ChordColor.MinorSeventhFlatFive:
                return(ChordColor.MajorSeventhFlatFive);

            case ChordColor.AugmentedNinth:
                return(ChordColor.MinorSeventhNinth);

            case ChordColor.MinorSeventhNinth:
                return(ChordColor.AugmentedNinth);

            case ChordColor.MajorSeventh:
                return(ChordColor.MinorSeventh);

            case ChordColor.MinorSeventh:
                return(ChordColor.MajorSeventh);

            case ChordColor.MajorSixth:
                return(ChordColor.MinorSixth);

            case ChordColor.MinorSixth:
                return(ChordColor.MajorSixth);

            case ChordColor.MajorSixthNinth:
                return(ChordColor.MinorSixthNinth);

            case ChordColor.MinorSixthNinth:
                return(ChordColor.MajorSixthNinth);

            case ChordColor.MajorNinth:
                return(ChordColor.MinorNinth);

            case ChordColor.MinorNinth:
                return(ChordColor.MajorNinth);

            case ChordColor.MajorEleventh:
                return(ChordColor.MinorEleventh);

            case ChordColor.MinorEleventh:
                return(ChordColor.MajorEleventh);

            case ChordColor.DominantSeventh:
                return(ChordColor.MinorMajorSeventh);

            case ChordColor.MinorMajorSeventh:
                return(ChordColor.DominantSeventh);

            default:
                return(c);
            }
        }
Esempio n. 10
0
 public static int GetResolution(this ChordColor c)
 {
     // The resolution is the number of bits in the literals of the enum.
     // They are stored on 32-bit integers, so 32 is returned.
     return(32);
 }
Esempio n. 11
0
        public static string ToString(this ChordColor c)
        {
            switch (c)
            {
            case ChordColor.Major:
                return("");

            case ChordColor.Minor:
                return("-");

            case ChordColor.Augmented:
                return("aug");

            case ChordColor.Diminished:
                return("dim");

            case ChordColor.FullAugmented:
                return("aug");

            case ChordColor.MinorSeventhFlatFive:
                return("-7b5");

            case ChordColor.AugmentedNinth:
                return("add9");

            case ChordColor.MinorSeventhNinth:
                return("-7,9");

            case ChordColor.MajorSeventh:
                return("7");

            case ChordColor.MinorSeventh:
                return("-7");

            case ChordColor.MajorSixth:
                return("6");

            case ChordColor.MinorSixth:
                return("-6");

            case ChordColor.MajorSixthNinth:
                return("6,9");

            case ChordColor.MinorSixthNinth:
                return("-6,9");

            case ChordColor.MajorNinth:
                return("9");

            case ChordColor.MinorNinth:
                return("-9");

            case ChordColor.MajorEleventh:
                return("11");

            case ChordColor.MinorEleventh:
                return("-11");

            case ChordColor.DominantSeventh:
                return("Maj7");

            case ChordColor.MinorMajorSeventh:
                return("-7Maj");

            case ChordColor.Mu1:
                return("Mu1");

            case ChordColor.Mu2:
                return("Mu2");

            case ChordColor.Mu3:
                return("Mu3");

            case ChordColor.Powerchord:
                return("P");

            case ChordColor.SeventhSuspensionFour:
                return("7add4");

            case ChordColor.Suspended:
                return("sus4");

            default:
                return("");
            }
        }