Exemplo n.º 1
0
        public static KeyRelation MusicKeyAndChordDegreeToKeyRelation(MusicKey key, CD chordDegree)
        {
            MusicKeyInfo mki = new MusicKeyInfo(key, KeyRelation.I調);

            KeyRelation kr = KeyRelation.Unknown;

            switch (chordDegree)
            {
            case CD.I: kr = KeyRelation.I調; break;

            case CD.II: /* 長調の時はII調、短調の時はない。 */
                if (mki.IsMajor())
                {
                    kr = KeyRelation.II調;
                }
                break;

            case CD.III: kr = KeyRelation.III調; break;

            case CD.IV: kr = KeyRelation.IV調; break;

            case CD.V: kr = KeyRelation.V調; break;

            case CD.VI: kr = KeyRelation.VI調; break;

            case CD.VII: /* 短調の時はVII調、長調の時はない。*/
                if (mki.IsMinor())
                {
                    kr = KeyRelation.VII調;
                }
                break;

            case CD.V_V:/* 長調のV調のV調は+II調、短調のV調のV調は△II調 */
                if (mki.IsMajor())
                {
                    kr = KeyRelation.PII調;
                }
                else
                {
                    kr = KeyRelation.TII調;
                }
                break;

            default: System.Diagnostics.Debug.Assert(false); break;
            }
            return(kr);
        }
Exemplo n.º 2
0
        private void MXOutputPartHeader(TextWriter w, string partId, ClefType clef)
        {
            w.WriteLine("  <part id=\"{0}\">", partId);
            w.WriteLine("    <measure number=\"0\">");
            w.WriteLine("      <attributes>");

            var mki = new MusicKeyInfo(chordSaves[0].musicKey, KeyRelation.I調);

            w.WriteLine("        <key>");
            w.WriteLine("          <fifths>{0}</fifths>", mki.FlatNum() - mki.SharpNum());
            w.WriteLine("          <mode>{0}</mode>", mki.IsMajor() ? "major" : "minor");
            w.WriteLine("        </key>");
            w.WriteLine("        <time>");
            w.WriteLine("          <beats>2</beats>");
            w.WriteLine("          <beat-type>2</beat-type>");
            w.WriteLine("        </time>");

            w.WriteLine("        <clef>");
            switch (clef)
            {
            case ClefType.G2:
                w.WriteLine("          <sign>G</sign>");
                w.WriteLine("          <line>2</line>");
                break;

            case ClefType.F4:
                w.WriteLine("          <sign>F</sign>");
                w.WriteLine("          <line>4</line>");
                break;

            default:
                System.Diagnostics.Debug.Assert(false);
                break;
            }
            w.WriteLine("        </clef>");

            w.WriteLine("      </attributes>");
            w.WriteLine("      <sound tempo=\"{0}\"/>", tempo);
        }
Exemplo n.º 3
0
        public ChordListGenerator(ChordType chordType)
        {
            CompleteDeg = false;

            this.ct   = chordType;
            chordList = new List <Chord>();

            chordLnDeg123467 = new List <LnDeg>();
            chordLnDeg5      = new List <LnDeg>();

            MusicKeyInfo mki = new MusicKeyInfo(ct.musicKey, ct.keyRelation);

            for (int i = 0; i < 7; ++i)
            {
                chordLnDeg123467.Add(new LnDeg(mki.GetLnFromDegree(i), i + 1));
            }

            if (ct.is準固有)
            {
                // 準固有和音
                chordLnDeg123467[2] = new LnDeg(chordLnDeg123467[2].LetterName.Flat(), 3);
                chordLnDeg123467[5] = new LnDeg(chordLnDeg123467[5].LetterName.Flat(), 6);
            }

            chordLnDeg5.Add(chordLnDeg123467[4]); // 根音  V
            chordLnDeg5.Add(chordLnDeg123467[6]); // 第3音 VII
            chordLnDeg5.Add(chordLnDeg123467[1]); // 第5音 II
            chordLnDeg5.Add(chordLnDeg123467[3]); // 第7音 IV
            chordLnDeg5.Add(chordLnDeg123467[5]); // 第9音 VI

            if (ct.Is内部調は短調())
            {
                if (ct.has固有VII)
                {
                    // 短調で短調固有のVIIを持つ。
                }
                else
                {
                    // 短調固有のVIIではなく和声的VIIを持つ。第3音(VIIの音)を半音上げる。
                    chordLnDeg5[1] = new LnDeg(chordLnDeg123467[6].LetterName.Sharp(), 7);
                }
            }

            if (ct.addedTone == AddedToneType.SixFour &&
                ct.chordDegree == CD.IV &&
                ct.Is内部調は短調())
            {
                // 短調のIV付加4-6の和音の場合 付加第4音(VIIの音)を半音上げる。
                chordLnDeg123467[6] = new LnDeg(chordLnDeg123467[6].LetterName.Sharp(), 7);
            }

            if (ct.alteration == AlterationType.Lowered)
            {
                switch (ct.chordDegree)
                {
                case CD.V:
                    // V_V 下方変位 第5音(II)がフラットになる
                    chordLnDeg5[2] = new LnDeg(chordLnDeg123467[1].LetterName.Flat(), 2);
                    CompleteDeg    = true;
                    break;

                default:
                    System.Diagnostics.Debug.Assert(false);
                    break;
                }
            }

            if (ct.alteration == AlterationType.Naples)
            {
                switch (ct.chordDegree)
                {
                case CD.II:
                    // II ナポリの和音 根音(II)がフラットになる
                    chordLnDeg123467[1] = new LnDeg(chordLnDeg123467[1].LetterName.Flat(), 2);
                    break;

                default:
                    System.Diagnostics.Debug.Assert(false);
                    break;
                }
            }

            if (ct.alteration == AlterationType.Dorian)
            {
                switch (ct.chordDegree)
                {
                case CD.IV:
                    // IV ドリアの和音 第3音(VI)がシャープになる
                    chordLnDeg123467[5] = new LnDeg(chordLnDeg123467[5].LetterName.Sharp(), 6);
                    break;

                default:
                    System.Diagnostics.Debug.Assert(false);
                    break;
                }
            }

            if (ct.alteration == AlterationType.Raised)
            {
                switch (ct.chordDegree)
                {
                case CD.V:
                case CD.V_V:
                    // V上方変位 第5音がシャープになる(III巻p.224)
                    chordLnDeg5[2] = new LnDeg(chordLnDeg123467[1].LetterName.Sharp(), 2);
                    CompleteDeg    = true;
                    break;

                case CD.IV:
                    // IV+6, IV+46の和音 第6音(II)がシャープになる(III巻p.226)
                    chordLnDeg123467[1] = new LnDeg(chordLnDeg123467[1].LetterName.Sharp(), 2);
                    break;

                default:
                    System.Diagnostics.Debug.Assert(false);
                    break;
                }
            }
        }