public MusicClipSet GetFirstClipSet() { clipSets.Clear(); ChordProgression chordProgression; if (previousChordProgression == null) { chordProgression = chordProgressionLibrary.GetRandomChordProgression(); } else { chordProgression = chordProgressionLibrary.GetRandomChordProgressionOtherThan(previousChordProgression); } previousChordProgression = chordProgression; Key key = GetRandomEnum <Key>(); Rhythm rhythm = GetRandomEnum <Rhythm>(); Tempo tempo = GetRandomEnum <Tempo>(); Debug.Log($"First clip created with Tempo: {tempo}, Rhythm: {rhythm}, Key: {key} and Chord Progression: {chordProgression.name}"); MusicClipSet clipSet = GenerateClipSetWithParameters(key, tempo, rhythm, chordProgression); clipSets.Add(clipSet); return(clipSet); }
public MusicClipSet GetNextClipSet(MusicClipResults[] musicClipResults) { clipResults = musicClipResults; UpdateWeights(); MusicalChange change; change = (calibrationMusicalChanges.Count > 0) ? GetRandomCalibrationMusicalChange() : FindNextMusicalChange(); //TODO: Add chord progression and Key changes periodically MusicClipSet musicClipSet = GenerateNextClipSetWithChange(change); clipSets.Add(musicClipSet); return(musicClipSet); }
private void QueueClips() { activeClipSet = clipSetProvider.GetFirstClipSet(); for (int i = 0; i < activeClipSet.ClipCount; i++) { musicMixer.QueueClip(activeClipSet.MusicClips[i]); } for (int j = 0; j < clipSetsPerSong - 1; j++) { activeClipSet = clipSetProvider.GetNextClipSet(clipResults.ToArray()); for (int i = 0; i < activeClipSet.ClipCount; i++) { musicMixer.QueueClip(activeClipSet.MusicClips[i]); } } }
private MusicalChange GetMusicalChangeBetweenSets(MusicClipSet first, MusicClipSet second) { if (first.IsEmpty) { return(MusicalChange.RestToPlay); } if (second.IsEmpty) { return(MusicalChange.PlayToRest); } if (first.Tempo != second.Tempo) { return(MusicalChange.Tempo); } if (first.Rhythm != second.Rhythm) { return(MusicalChange.Rhythm); } else { return(MusicalChange.Key); } }