Exemplo n.º 1
0
    /// <summary>
    /// Get all triads from the given intervals, that include more than one octave. Each interval has to be smaller than the next one.
    /// </summary>
    /// <param name="key">The wanted key.</param>
    /// <param name="intervals">Intervals [1-7]. Amount has to be 3.</param>
    public static Chord[] AllBigTriads(Key key, int degree, int[] intervals, int minNote, int maxNote)
    {
        // 1. Get Intervals from Big Chords
        int[][] bigIntervals = Chords.BigChordStructures(intervals, key.notesPerOctave);
        Chord[] chords       = new Chord[bigIntervals.Length];

        // 2. Get all chords within one octave
        for (int i = 0; i < bigIntervals.Length; i++)
        {
            chords[i] = Triad(key, degree, bigIntervals[i], 0);
        }

        // 3. Get all chords withing tone range
        List <Chord> allChords  = new List <Chord>();
        int          allOctaves = allMidiNotes / notesPerOctave - 1;

        for (int i = 0; i < allOctaves; i++)
        {
            for (int j = 0; j < chords.Length; j++)
            {
                bool chordIsWithinRange = ChordIsWithinRange(chords[j], minNote, maxNote);
                if (chordIsWithinRange)
                {
                    allChords.Add(chords[j].DeepCopy());
                }
                chords[j] = Transpose_BySemiTones(chords[j], notesPerOctave);
            }
        }


        return(allChords.ToArray());
    }