Esempio n. 1
0
 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)
     });
 }
Esempio n. 2
0
        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));
        }
Esempio n. 3
0
        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));
        }