Exemple #1
0
        private static void Player3_Delay()
        {
            // use clock to schedule

            var player = new MidiPlayer(0);

            player.SetInstrument(0, 43 - 1); // Cello
            player.SetInstrument(1, 0);      // Piano

            player.ScheduleNote(1, 1200f, delay: 0f, duration: 4f);
            player.ScheduleNote(1, 1230f, delay: 1f, duration: 4f);
            player.ScheduleNote(0, 1260f, delay: 2f, duration: 4f);

            player.StartClock(60 * 2, waitForEnd: true);

            player.Dispose();
        }
Exemple #2
0
        private static void Player2_Duration()
        {
            // use clock for note duration

            var player = new MidiPlayer(0);

            player.StartClock(60 * 4);

            player.SetInstrument(0, 72 - 1);  // Clarinet
            player.SetInstrument(1, 106 - 1); // Banjo

            player.NoteOn(0, 1200f, duration: 8f);

            Thread.Sleep(500);
            player.NoteOn(0, 1230f, duration: 8f);

            Thread.Sleep(500);
            player.NoteOn(1, 1260f, duration: 8f);

            Thread.Sleep(5000);

            player.StopClock();
            player.Dispose();
        }