MCPcopy Create free account
hub / github.com/bspaans/python-mingus / to_hertz

Method to_hertz

mingus/containers/note.py:225–233  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.

Callers 2

fft.pyFile · 0.80
test_to_hertzMethod · 0.80

Calls 1

__int__Method · 0.95

Tested by 1

test_to_hertzMethod · 0.64