public void SetScale(ScaleBase scale) { StringNotes = new List <ScaleNote[]>(); foreach (var note in StringTuning) { var notes = new ScaleNote[NumberOfFrets]; notes[0] = scale.ChromaticNotes.First(x => x.Note.Index == note.Index); StringNotes.Add(notes); } foreach (var s in StringNotes) { var scaleNote = s[0]; var openNoteIndex = scaleNote.Note.Index; for (int i = 1; i < NumberOfFrets; i++) { var noteIndex = (openNoteIndex + i) % 12; scaleNote = scale.ChromaticNotes.First(x => x.Note.Index == noteIndex); s[i] = scaleNote; } } }
private ScaleNote[] GetChromaticNotes() { var naturalNote = RootNote.Natural != null ? RootNote.Natural : RootNote; var naturalIndex = Array.IndexOf(MusicNotes.NaturalNotes, naturalNote); var naturalNotes = GetScaleNaturals(naturalIndex); var intervals = ScaleFamily.GetModeIntervals(Mode); var noteCount = intervals.Count(x => x); var noteIndex = 0; IntervalTableItem interval; var notes = new List <ScaleNote>(); for (int i = 0; i < 12; i++) { var isIntervalPresent = intervals[i]; if (isIntervalPresent && ScaleFamily.IsSevenNoteScale) { interval = Intervals.IntervalTable.GetRow(i).First(x => x.ScaleDegree == noteIndex); noteIndex = (noteIndex + 1) % noteCount; } else { interval = Intervals.IntervalTable.GetRow(i)[0]; } naturalNote = naturalNotes[interval.ScaleDegree]; var index = (RootNote.Index + i) % 12; var note = MusicNotes.Notes.First(x => x.Name == naturalNote.Name && x.Index == index); var scaleNote = new ScaleNote(this, note, i, isIntervalPresent, interval); notes.Add(scaleNote); } return(notes.ToArray()); }