Give the traditional Helmhotz pitch notation. Examples: >>> Note('C-4').to_shorthand() "c'" >>> Note('C-3').to_shorthand() 'c' >>> Note('C-2').to_shorthand() 'C' >>> Note('C-1').to_shorthand() 'C,'
(self)
| 246 | return self |
| 247 | |
| 248 | def to_shorthand(self): |
| 249 | """Give the traditional Helmhotz pitch notation. |
| 250 | |
| 251 | Examples: |
| 252 | >>> Note('C-4').to_shorthand() |
| 253 | "c'" |
| 254 | >>> Note('C-3').to_shorthand() |
| 255 | 'c' |
| 256 | >>> Note('C-2').to_shorthand() |
| 257 | 'C' |
| 258 | >>> Note('C-1').to_shorthand() |
| 259 | 'C,' |
| 260 | """ |
| 261 | if self.octave < 3: |
| 262 | res = self.name |
| 263 | else: |
| 264 | res = str.lower(self.name) |
| 265 | o = self.octave - 3 |
| 266 | while o < -1: |
| 267 | res += "," |
| 268 | o += 1 |
| 269 | while o > 0: |
| 270 | res += "'" |
| 271 | o -= 1 |
| 272 | return res |
| 273 | |
| 274 | def from_shorthand(self, shorthand): |
| 275 | """Convert from traditional Helmhotz pitch notation. |
no outgoing calls