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

Method degree

mingus/core/scales.py:131–146  ·  view source on GitHub ↗

Return the asked scale degree. The direction of the scale is 'a' for ascending (default) and 'd' for descending.

(self, degree_number, direction="a")

Source from the content-addressed store, hash-verified

129 return list(reversed(self.ascending()))
130
131 def degree(self, degree_number, direction="a"):
132 """Return the asked scale degree.
133
134 The direction of the scale is 'a' for ascending (default) and 'd'
135 for descending.
136 """
137 if degree_number < 1:
138 raise RangeError("degree '%s' out of range" % degree_number)
139 if direction == "a":
140 notes = self.ascending()[:-1]
141 return notes[degree_number - 1]
142 elif direction == "d":
143 notes = list(reversed(self.descending())[:-1])
144 return notes[degree_number - 1]
145 else:
146 raise FormatError("Unrecognised direction '%s'" % direction)
147
148
149# The diatonic scales

Callers

nothing calls this directly

Calls 4

ascendingMethod · 0.95
descendingMethod · 0.95
RangeErrorClass · 0.90
FormatErrorClass · 0.90

Tested by

no test coverage detected