void PlayNote() { int note = _key + _notes [Random.Range(0, _notes.Length)]; if (!_synth.IsNoteOn(note)) { _synth.NoteOn(note, 1, Metronome.instance.GetBeatDur() / 2f); } }
public static void PlayChord(Chord chord, HelmController controller, float velocity) { for (int i = 0; i < chord.notes.Length; i++) { int note = chord.notes[i]; if (controller.IsNoteOn(note)) { controller.NoteOff(note); } controller.NoteOn(note, velocity); } }
public static void StopChord(Chord chord, HelmController controller, Sequencer sequencer, bool forceNoteOff = false) { for (int i = 0; i < chord.notes.Length; i++) { int note = chord.notes[i]; if (controller.IsNoteOn(note)) { // 2. Stop only if the notes are NOT being played in the sequencer if (!sequencer.IsNoteOn(note) || forceNoteOff) { controller.NoteOff(note); } } } }