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

Method __int__

mingus/containers/note.py:302–315  ·  view source on GitHub ↗

Return the current octave multiplied by twelve and add notes.note_to_int to it. This means a C-0 returns 0, C-1 returns 12, etc. This method allows you to use int() on Notes.

(self)

Source from the content-addressed store, hash-verified

300 return self.set_note(name, octave, {})
301
302 def __int__(self):
303 """Return the current octave multiplied by twelve and add
304 notes.note_to_int to it.
305
306 This means a C-0 returns 0, C-1 returns 12, etc. This method allows
307 you to use int() on Notes.
308 """
309 res = self.octave * 12 + notes.note_to_int(self.name[0])
310 for n in self.name[1:]:
311 if n == "#":
312 res += 1
313 elif n == "b":
314 res -= 1
315 return res
316
317 def __lt__(self, other):
318 """Enable the comparing operators on Notes (>, <, \ ==, !=, >= and <=).

Callers 1

to_hertzMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected