[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Pitch questions
From: |
Han-Wen Nienhuys |
Subject: |
Re: Pitch questions |
Date: |
Wed, 10 Oct 2007 23:14:46 -0300 |
2007/10/10, Rune Zedeler <address@hidden>:
> void
> Pitch::transpose (Pitch delta)
> {
> Rational new_alter = tone_pitch () + delta.tone_pitch ();
>
> octave_ += delta.octave_;
> notename_ += delta.notename_;
> alteration_ += new_alter - tone_pitch ();
>
> normalize ();
> }
>
> This looks very ineffecient.
>
> Rational new_alter = tone_pitch () + delta.tone_pitch ();
> alteration_ += new_alter - tone_pitch ();
>
> is equivalent to
>
> alteration_ += delta.tone_pitch ();
No it's not. tone_pitch() changes in between since notename_ is changed.
Think about: a major third on B is D#, so alteration is changed by an
amount that is
is not equal to the alteration of E-natural.
--
Han-Wen Nienhuys - address@hidden - http://www.xs4all.nl/~hanwen
- Pitch questions, Rune Zedeler, 2007/10/10
- Re: Pitch questions,
Han-Wen Nienhuys <=