// Used to create rhythms using AI algorithms. public Rhythm(Dictionary <int, int> _rhythmStructure, List <bool> _ignoreClaps) { this._rhythmStructure = _rhythmStructure; this._ignoreClaps = _ignoreClaps; _isComputerGenerated = true; _rhythmClass = RhythmClass.GENERAL_RHYTHM; _rhythmType = RhythmType.GENERAL_CLAPS; }
public Rhythm(RhythmClass rhythmClass, Dictionary <int, int> _rhythmStructure, List <bool> _ignoreClaps, bool _isComputerGenerated) { this._rhythmStructure = _rhythmStructure; this._ignoreClaps = _ignoreClaps; this._isComputerGenerated = _isComputerGenerated; _rhythmClass = rhythmClass; DetermineRhythmType(); }
// Combine two different rhythms. public void ConcatenateRhythm(Rhythm anotherRhythm, int timeInBetween) { Rhythm rhythm = ConcatenateRhythm(this, anotherRhythm, timeInBetween); _rhythmStructure = rhythm._rhythmStructure; _ignoreClaps = rhythm._ignoreClaps; _isComputerGenerated = rhythm._isComputerGenerated; _rhythmClass = rhythm._rhythmClass; _rhythmType = rhythm._rhythmType; }
public Rhythm(RhythmClass rhythmClass, int numberOfSeconds) { _ignoreClaps = new List <bool>(); _rhythmStructure = new Dictionary <int, int>(); _isComputerGenerated = false; _rhythmClass = rhythmClass; FillRhythmStructure(rhythmClass, numberOfSeconds); FillIgnoreClaps(numberOfSeconds); DetermineRhythmType(); }
public Rhythm() { _ignoreClaps = new List <bool>(); _rhythmStructure = new Dictionary <int, int>(); _isComputerGenerated = false; _rhythmType = RhythmType.SIMILAR_CLAPS; _rhythmClass = RhythmClass.RHYTHM_ONE; for (int index = 1; index <= 300; index++) { _ignoreClaps.Add(false); _rhythmStructure.Add(index * 1000, 1); } }
public Rhythm(RhythmClass rhythmClass, int numberOfSeconds, List <bool> _ignoreClaps) { _rhythmClass = rhythmClass; _rhythmStructure = new Dictionary <int, int>(); _isComputerGenerated = false; FillRhythmStructure(rhythmClass, numberOfSeconds); if (_rhythmStructure.Count == _ignoreClaps.Count) { this._ignoreClaps = _ignoreClaps; } else { FillIgnoreClaps(numberOfSeconds); } DetermineRhythmType(); }
// Create any one of the twelve rhythms strucures. // This method only works with predefined rhythm classes. // Meaning a general rhythm structure isn't applicable of this method. public void FillRhythmStructure(RhythmClass rhythmClass, int numberOfSeconds) { switch (rhythmClass) { case RhythmClass.RHYTHM_ONE: // 1 1 1 1 1... for (int index = 1; index <= numberOfSeconds; index++) { _rhythmStructure.Add(index * 1000, 1); } break; case RhythmClass.RHYTHM_TWO: // 2 2 2 2 2... for (int index = 1; index <= numberOfSeconds; index++) { _rhythmStructure.Add(index * 1000, 2); } break; case RhythmClass.RHYTHM_THREE: // 3 3 3 3 3 3... for (int index = 1; index <= numberOfSeconds; index++) { _rhythmStructure.Add(index * 1000, 3); } break; case RhythmClass.RHYTHM_FOUR: // 2 1 2 1 2 1... for (int index = 1; index <= numberOfSeconds; index++) { if (index % 2 == 0) { _rhythmStructure.Add(index * 1000, 1); } else { _rhythmStructure.Add(index * 1000, 2); } } break; case RhythmClass.RHYTHM_FIVE: // 3 1 3 1 3 1... for (int index = 1; index <= numberOfSeconds; index++) { if (index % 2 == 0) { _rhythmStructure.Add(index * 1000, 1); } else { _rhythmStructure.Add(index * 1000, 3); } } break; case RhythmClass.RHYTHM_SIX: // 3 2 3 2 3 2... for (int index = 1; index <= numberOfSeconds; index++) { if (index % 2 == 0) { _rhythmStructure.Add(index * 1000, 2); } else { _rhythmStructure.Add(index * 1000, 3); } } break; case RhythmClass.RHYTHM_SEVEN: // 2 3 1 2 3 1... for (int index = 1; index <= numberOfSeconds; index++) { if (index % 3 == 0) { _rhythmStructure.Add(index * 1000, 1); } else if (index % 3 == 1) { _rhythmStructure.Add(index * 1000, 2); } else { _rhythmStructure.Add(index * 1000, 3); } } break; case RhythmClass.RHYTHM_EIGHT: // 2 1 3 2 1 3 2 1 3... for (int index = 1; index <= numberOfSeconds; index++) { if (index % 3 == 0) { _rhythmStructure.Add(index * 1000, 3); } else if (index % 3 == 1) { _rhythmStructure.Add(index * 1000, 2); } else { _rhythmStructure.Add(index * 1000, 1); } } break; case RhythmClass.RHYTHM_NINE: // 3 2 1 3 2 1 3 2 1... for (int index = 1; index <= numberOfSeconds; index++) { if (index % 3 == 0) { _rhythmStructure.Add(index * 1000, 1); } else if (index % 3 == 1) { _rhythmStructure.Add(index * 1000, 3); } else { _rhythmStructure.Add(index * 1000, 2); } } break; case RhythmClass.RHYTHM_TEN: // 1 2 3 1 2 3... for (int index = 1; index <= numberOfSeconds; index++) { if (index % 3 == 0) { _rhythmStructure.Add(index * 1000, 3); } else if (index % 3 == 1) { _rhythmStructure.Add(index * 1000, 1); } else { _rhythmStructure.Add(index * 1000, 2); } } break; case RhythmClass.RHYTHM_ELEVEN: // 1 3 2 1 3 2... for (int index = 1; index <= numberOfSeconds; index++) { if (index % 3 == 0) { _rhythmStructure.Add(index * 1000, 2); } else if (index % 3 == 1) { _rhythmStructure.Add(index * 1000, 1); } else { _rhythmStructure.Add(index * 1000, 3); } } break; default: // 3 1 2 3 1 2... for (int index = 1; index <= numberOfSeconds; index++) { if (index % 3 == 0) { _rhythmStructure.Add(index * 1000, 2); } else if (index % 3 == 1) { _rhythmStructure.Add(index * 1000, 3); } else { _rhythmStructure.Add(index * 1000, 1); } } break; } }