public static MusicalNote CreateNote(NoteName note, int octave, IntonationMethod intonation = IntonationMethod.EqualTempered) { return(new MusicalNote { _NoteName = note, _Octave = octave, _BaseIntonation = intonation, _Pitch = NoteConverter.GetPitchFromNote(note, octave, intonation) }); }
public static PitchValue GetPitchFromNote(NoteName note, int octave, IntonationMethod intonation) { var noteCents = octave * 1200d; switch (intonation) { default: case IntonationMethod.EqualTempered: noteCents += IntonationRatioToCents(Math.Pow(TwelfthRoot, (int)note)); break; case IntonationMethod.Just: noteCents += IntonationRatioToCents(JustScaleRatios[(int)note]); break; } return(PitchValue.FromCents(noteCents)); }
public MusicalNote AddSteps(int steps, IntonationMethod newIntonation) { var baseSteps = (Octave * 12 + (int)NoteName) + steps; return(CreateNote((NoteName)(baseSteps % 12), (int)Math.Floor(baseSteps / 12d), newIntonation)); }