/// <summary> /// Returns a new key. /// </summary> /// <param name="keyNote">The note defining the key [0-11]. (0=C, 7=G, 11=H).</param> /// <param name="scale">The wanted scale.</param> public static Key ChangeKey(int keyNote, Scale.Name scale) { keyNote = ExtensionMethods.Modulo(keyNote, Scale.types[scale].Length); Key key = new Key(keyNote, scale); return(key); }
// PUBLIC METHODS public void Set(int keyNote, Scale.Name scale) { this.Scale = scale; this.KeyNote = keyNote; this.stepsInOctave = global::Scale.types[scale]; this.notesPerOctave = global::Scale.types[scale].Length; this.notes = GetScaleNotes(keyNote, stepsInOctave, notesPerOctave); this.keyNoteIndex = System.Array.IndexOf(this.notes, this.KeyNote); }
public static Key RandomKey() { int randKeyNote = Random.Range(0, MusicUtil.notesPerOctave); Scale.Name randScale = ExtensionMethods.RandomEnumValue <Scale.Name>(); Key key = new Key(randKeyNote, randScale); return(key); }
private int[] stepsInOctave; // Alle Intervalle von der Prim der Skala aus, die die Skala innerhalb einer Oktave ausmachen // CONSTRUCTOR /// <param name="keyNote">The note defining the key [0-11]. (0=C, 7=G, 11=H).</param> /// <param name="scale">The wanted scale.</param> public Key(int keyNote, Scale.Name scale) { Set(keyNote, scale); }