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

Method to_shorthand

mingus/containers/note.py:248–272  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.

Callers 3

begin_trackFunction · 0.80
_get_qsizeFunction · 0.80
test_to_shorthandMethod · 0.80

Calls

no outgoing calls

Tested by 1

test_to_shorthandMethod · 0.64