Exemple #1
0
    private static void PlayTones(Tone[] tones, int quarterNoteLength)
    {
        notesPlayed.Add(new List<Note>());

        foreach (var t in tones.Select((tone, idx) => new { tone, idx }))
        {
            Console.Write(t.tone.ToString());
            if(t.idx == 11)
            {
                Console.WriteLine("");
            }
            else
            {
                Console.Write(",");
            }

            Tone tone = t.tone;
            int length = rand.Next(1, 5) * quarterNoteLength;
            notesPlayed.Last().Add(new Note(tone, length));

            PlayNote(notesPlayed.Last().Last());
        }
    }