Return the asked scale degree. The direction of the scale is 'a' for ascending (default) and 'd' for descending.
(self, degree_number, direction="a")
| 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 |
nothing calls this directly
no test coverage detected