예제 #1
0
        private void setNotePitch(int midiKey)
        {
            int octave = (midiKey / 12) - 1;
            var x      = pitches[midiKey % 12];
            var y      = midiKey % 12;

            noteBuilder.SetPitch(pitches[y]);
            NoteBuilderSetSemitone(y);

            noteBuilder.ClearOctave();
            noteBuilder.ModifyOctave(2);
            int octaveModifier = midiKey;

            while (octaveModifier < 60 || octaveModifier > 71)
            {
                if (octaveModifier < 60)
                {
                    noteBuilder.ModifyOctave(-1);
                    octaveModifier += 12;
                }
                else if (octaveModifier > 71)
                {
                    noteBuilder.ModifyOctave(1);
                    octaveModifier -= 12;
                }
            }
        }