示例#1
0
    private static void PlaySonata(Matrix m)
    {
        int quarterNoteLength = 250;
        for (int i = 0; i < 24; i++)
        {
            Tone[] tones;

            if (i == 0)
            {
                tones = m.Row(0);
            }
            else
            {
                tones = RandomSequence(m);
            }
            if (i > 7)
            {
                quarterNoteLength = 750;
            }
            if (i > 11)
            {
                quarterNoteLength = 150;
            }

            PlayTones(tones, quarterNoteLength);
        }
    }
示例#2
0
    private static void PlayBinary(Matrix m)
    {
        int quarterNoteLength = 250;

        PlayBinarySection(m, quarterNoteLength);

        quarterNoteLength = 150;
        PlayBinarySection(m, quarterNoteLength);
    }
示例#3
0
    public static void Main()
    {
        rand = new Random();
        var schoenOp25 = new Tone[] { Tone.E, Tone.F, Tone.G, Tone.Db, Tone.Gb, Tone.Eb, Tone.Ab, Tone.D, Tone.B, Tone.C, Tone.A, Tone.Bb };

        Matrix m = new Matrix(schoenOp25);

        Console.WriteLine(m);
        Console.WriteLine("");

        PlaySonata(m);

        Console.WriteLine("");
        Console.WriteLine("Finé");

        Console.ReadLine();
    }
示例#4
0
    private static void PlayBinarySection(Matrix m, int quarterNoteLength)
    {
        for (int i = 0; i < 2; i++)
        {
            Tone[] tones;

            if (i == 0)
            {
                tones = m.Row(0);
            }
            else
            {
                tones = RandomSequence(m);
            }

            PlayTones(tones, quarterNoteLength);
        }
        foreach (Note n in notesPlayed.SelectMany(nl => nl)) PlayNote(n);
        notesPlayed.Clear();
        Console.WriteLine("");
    }
示例#5
0
    private static Tone[] RandomSequence(Matrix m)
    {
        Tone[] tones;
        var playColumn = rand.Next(0, 2) == 0;
        var backwards = rand.Next(0, 2) == 0;
        int index = rand.Next(0, 12);

        if (playColumn)
        {
            tones = m.Column(index).ToArray();
        }
        else
        {
            tones = m.Row(index);
        }
        if (backwards)
        {
            tones = tones.Reverse().ToArray();
        }
        return tones;
    }