static void Play(IEnumerable<Note> notes, PatchNames instrument = PatchNames.Vibraphone) { MusicPlayer player = new MusicPlayer(); player.SetPatch((int)instrument, 1); player.PlayNotes(notes); player.Close(); }
static void FMajorTest() { MusicPlayer player2 = new MusicPlayer(); Random r = new Random(); for (int i = 0; i < 20; i++ ) { int c = StandardKeys.C_MAJOR[r.Next(0, StandardKeys.F_MAJOR.Length)]; player2.PlayNotes(new Note[] { new Note((NoteNames)c, 4 + r.Next(0, 2), Durations.qn) }); } int d = StandardKeys.C_MAJOR[r.Next(0, StandardKeys.F_MAJOR.Length)]; player2.PlayNotes(new Note[] { new Note((NoteNames)d, 5, Durations.hn) }); d = StandardKeys.C_MAJOR[r.Next(0, StandardKeys.F_MAJOR.Length)]; player2.PlayNotes(new Note[] { new Note((NoteNames)d, 3, Durations.wn) }); }