private void StartInversion() { var scale = ChosenScale; var progression = Triad.ChordGen(scale, ProgressionPattern, ColorPattern, Repeat); var chordInv = Triad.Inversion(progression, OctavePattern, InversionPattern, ChosenKey); var counter = 0; RemainingCount = chordInv.Chords.Count; ThreadPool.QueueUserWorkItem( o => { foreach (var chord in chordInv.Chords) { SetNotes(chord.Notes); MidiLogic.PlayChord(_mOut, SelectedChannel, 127, chord.Notes.ToArray()); Thread.Sleep(LengthPattern[counter % LengthPattern.Count]); MidiLogic.StopChord(_mOut, SelectedChannel, 127, chord.Notes.ToArray()); counter++; RemainingCount -= 1; } } ); }