public static void Initialize(int numBars) { markov = new MarkovChain(8, 1); progressions = new Dictionary <SectionType, int[]>(); for (int i = 0; i < SongStructure.Length(); ++i) { var section = SongStructure.GetSection(i); if (!progressions.ContainsKey(section)) { if (section != SectionType.BRIDGE) { markov.Reset(); } int[] progression = new int[numBars]; for (int bar = 0; bar < numBars; ++bar) { progression[bar] = markov.CurrentState; markov.GenerateNextState(); } progressions.Add(section, progression); } } }