Пример #1
0
 def __init__(self, root_symbol=None, function='T', root_number=None):
     """
     Either root_symbol or root_number must be given.
     
     Will raise a ChordError if the root symbol can't be interpreted 
     as a root number.
     
     @type root_symbol: string
     @param root_symbol: symbol to interpret as the root of this 
         category. This will be converted to a root number.
     @type function: string or list of strings
     @param function: either a single function marker (usually 
         'T', 'D' and 'S') or a list of such function markers, 
         as in the case of a complex category's argument.
     @type root_number: int
     @param root_number: alternative to setting the root by a 
         symbol. This will be used in preferance to root_symbol if 
         given.
     
     """
     if root_number is not None:
         # This is already a numeric root
         self.root = root_number
     elif root_symbol is not None:
         try:
             # Try treating this as a chord root
             self.root = chord_numeral_to_int(root_symbol, strict=True)
         except ChordError, err:
             raise ChordError, "could not treat '%s' as a root "\
                 "symbol: %s" % (root_symbol, err)
Пример #2
0
 def __init__(self, root_symbol=None, function='T', root_number=None):
     """
     Either root_symbol or root_number must be given.
     
     Will raise a ChordError if the root symbol can't be interpreted 
     as a root number.
     
     @type root_symbol: string
     @param root_symbol: symbol to interpret as the root of this 
         category. This will be converted to a root number.
     @type function: string or list of strings
     @param function: either a single function marker (usually 
         'T', 'D' and 'S') or a list of such function markers, 
         as in the case of a complex category's argument.
     @type root_number: int
     @param root_number: alternative to setting the root by a 
         symbol. This will be used in preferance to root_symbol if 
         given.
     
     """
     if root_number is not None:
         # This is already a numeric root
         self.root = root_number
     elif root_symbol is not None:
         try:
             # Try treating this as a chord root
             self.root = chord_numeral_to_int(root_symbol, strict=True)
         except ChordError, err:
             raise ChordError, "could not treat '%s' as a root "\
                 "symbol: %s" % (root_symbol, err)
Пример #3
0
 def _set_root_numeral(self, value):
     if self.roman:
         self._root = chord_numeral_to_int(value)
     else:
         self._root = pitch_class_to_int(value)