Return the Note in Hz. The standard_pitch argument can be used to set the pitch of A-4, from which the rest is calculated.
(self, standard_pitch=440)
| 223 | return int(other) - int(self) |
| 224 | |
| 225 | def to_hertz(self, standard_pitch=440): |
| 226 | """Return the Note in Hz. |
| 227 | |
| 228 | The standard_pitch argument can be used to set the pitch of A-4, |
| 229 | from which the rest is calculated. |
| 230 | """ |
| 231 | # int(Note("A")) == 57 |
| 232 | diff = self.__int__() - 57 |
| 233 | return 2 ** (diff / 12.0) * standard_pitch |
| 234 | |
| 235 | def from_hertz(self, hertz, standard_pitch=440): |
| 236 | """Set the Note name and pitch, calculated from the hertz value. |