private void GenerateVmollOmitRChordMidi(ChordType ct, string desc, ref int [] n)
        {
            var keys = new KeyAndName[] {
                new KeyAndName(MusicKey.Cmoll, "H"),
                new KeyAndName(MusicKey.CISmoll, "C"),
                new KeyAndName(MusicKey.Dmoll, "Cis"),
                new KeyAndName(MusicKey.ESmoll, "D"),
                new KeyAndName(MusicKey.Emoll, "Es"),
                new KeyAndName(MusicKey.Fmoll, "E"),
                new KeyAndName(MusicKey.FISmoll, "F"),
                new KeyAndName(MusicKey.Gmoll, "Fis"),
                new KeyAndName(MusicKey.ASmoll, "G"),
                new KeyAndName(MusicKey.Amoll, "As"),
                new KeyAndName(MusicKey.Bmoll, "A"),
                new KeyAndName(MusicKey.Hmoll, "B"),
            };

            ct.chordDegree = CD.V;
            System.Diagnostics.Debug.Assert(ct.omission == Omission.First);

            int ik = 0;

            foreach (var k in keys)
            {
                ct.musicKey = k.k;

                var pos = new PositionOfAChord[] { PositionOfAChord.密, PositionOfAChord.開, PositionOfAChord.Oct };
                foreach (var p in pos)
                {
                    ct.positionOfAChord = p;

                    ChordListGenerator clg = new ChordListGenerator(ct);
                    clg.CompleteDeg = true;
                    var chords = clg.Generate();
                    for (int i = 0; i < chords.Count(); ++i)
                    {
                        List <Chord> chord1 = new List <Chord>();
                        chord1.Add(chords[i]);
                        using (var bw = new BinaryWriter(File.Open(string.Format("midi/{0}{1}_{2}.mid", k.name, desc, n[ik]), FileMode.Create))) {
                            var mm = Chord.ChordListToMidiFile(chord1, 60);
                            mm.Write(bw);
                        }
                        ++n[ik];
                    }
                }

                ++ik;
            }
        }
        private void GenerateIdurChordMidi(ChordType ct, string desc, bool completeDeg, ref int[] n)
        {
            var keys = new KeyAndName[] {
                new KeyAndName(MusicKey.Cdur, "C"),
                new KeyAndName(MusicKey.CISdur, "Cis"),
                new KeyAndName(MusicKey.Ddur, "D"),
                new KeyAndName(MusicKey.ESdur, "Es"),
                new KeyAndName(MusicKey.Edur, "E"),
                new KeyAndName(MusicKey.Fdur, "F"),
                new KeyAndName(MusicKey.FISdur, "Fis"),
                new KeyAndName(MusicKey.Gdur, "G"),
                new KeyAndName(MusicKey.ASdur, "As"),
                new KeyAndName(MusicKey.Adur, "A"),
                new KeyAndName(MusicKey.Bdur, "B"),
                new KeyAndName(MusicKey.Hdur, "H"),
            };

            ct.chordDegree = CD.I;

            int ik = 0;

            foreach (var k in keys)
            {
                ct.musicKey = k.k;

                var pos = new PositionOfAChord[] { PositionOfAChord.密, PositionOfAChord.開, PositionOfAChord.Oct };
                foreach (var p in pos)
                {
                    ct.positionOfAChord = p;

                    ChordListGenerator clg = new ChordListGenerator(ct);
                    clg.CompleteDeg = completeDeg;
                    var chords = clg.Generate();
                    for (int i = 0; i < chords.Count(); ++i)
                    {
                        List <Chord> chord1 = new List <Chord>();
                        chord1.Add(chords[i]);
                        using (var bw = new BinaryWriter(File.Open(string.Format("midi/{0}{1}_{2}.mid", k.name, desc, n[ik]), FileMode.Create))) {
                            var mm = Chord.ChordListToMidiFile(chord1, 60);
                            mm.Write(bw);
                        }
                        ++n[ik];
                    }
                }

                ++ik;
            }
        }
Exemplo n.º 3
0
 private void GenerateUpper3(bool standard, Pitch bas, List <LnDegInversion> upper3, PositionOfAChord positionOfAChord)
 {
     GenerateUpper3Step(standard, bas, upper3, 1, positionOfAChord);
     GenerateUpper3Step(standard, bas, upper3, 2, positionOfAChord);
 }
Exemplo n.º 4
0
        private void GenerateUpper3Step(bool standard, Pitch bas, List <LnDegInversion> upper3, int step, PositionOfAChord positionOfAChord)
        {
            for (int i = 0; i < upper3.Count; ++i)
            {
                for (int tenOct = Pitch.TenLowestOctave(); tenOct <= Pitch.TenHighestOctave(); ++tenOct)
                {
                    Pitch ten = new Pitch(upper3[i], tenOct);
                    if (!ten.IsWithinTheRange(Part.Ten))
                    {
                        continue;
                    }

                    for (int altOct = Pitch.AltLowestOctave(); altOct <= Pitch.AltHighestOctave(); ++altOct)
                    {
                        Pitch alt = new Pitch(upper3[(i + step) % upper3.Count], altOct);
                        if (!alt.IsWithinTheRange(Part.Alt))
                        {
                            continue;
                        }

                        for (int sopOct = Pitch.SopLowestOctave(); sopOct <= Pitch.SopHighestOctave(); ++sopOct)
                        {
                            Pitch sop = new Pitch(upper3[(i + step * 2) % upper3.Count], sopOct);
                            if (!sop.IsWithinTheRange(Part.Sop))
                            {
                                continue;
                            }

                            Chord chord = new Chord(ct, standard, bas, ten, alt, sop);
                            if (chord.Verdict != VerdictValue.Delist &&
                                chord.IsWithinTheRange() &&
                                chord.Upper3PositionIsCorrect() &&
                                !chordList.Contains(chord, new ChordEqualityComparer()))
                            {
                                //System.Console.WriteLine("{0} {1} {2}", ten.LetterName.LN, alt.LetterName.LN, sop.LetterName.LN);
                                chordList.Add(chord);
                            }
                        }
                    }
                }
            }
        }