- Rational pitch = tone_pitch ();
- while (notename_ >= (int) scale_->step_tones_.size ())
- {
- notename_ -= scale_->step_tones_.size ();
- octave_++;
- alteration_ -= tone_pitch () - pitch;
- }
- while (notename_ < 0)
- {
- notename_ += scale_->step_tones_.size ();
- octave_--;
- alteration_ -= tone_pitch () - pitch;
- }
+ int normalized_step = notename_ % scale_->step_count ();
+ if (normalized_step < 0)
+ normalized_step += scale_->step_count ();