Package jazzparser :: Package data :: Class Chord
[hide private]
[frames] | no frames]

Class Chord

source code

object --+
         |
        Chord

A Chord object represents a single chord in an input sequence to the parser.

This was the original way of processing input to the parser and still lurks around. However, a better representation is provided by jazzparser.data.db_mirrors.Chord, which is specifically designed to replicate the data structure in the corpus database. Instances of this class can be converted to a db-mirror chord using to_db_mirror. This class is now used mainly for processing textual input.

Instance Methods [hide private]
 
_get_root(self) source code
 
_set_root(self, value) source code
 
_get_root_numeral(self) source code
 
_set_root_numeral(self, value) source code
 
_get_type(self) source code
 
_set_type(self, value) source code
 
__init__(self, root_numeral='C', type='', additions=None, roman=False)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
__hash__(self)
hash(x)
source code
 
__ne__(self, other) source code
 
__eq__(self, other) source code
 
equal_bar_additions(self, other) source code
 
_get_tetrad_type(self)
Returns the implicit or explicit tetrad type of the chord.
source code
 
__str__(self)
str(x)
source code
 
__repr__(self)
repr(x)
source code
 
to_latex(self) source code
 
to_db_mirror(self)
Produce a db mirror Chord instance (see jazzparser.data.db_mirrors that represents the same chord as this.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

Static Methods [hide private]
 
interval(chord1, chord2)
Returns the interval from chord1 to chord2.
source code
 
from_name(chord_name, roman=False, permissive=False)
Given a string chord name, returns the Chord object corresponding to that name.
source code
Class Variables [hide private]
  TYPE_SYMBOLS = {1: '', 2: 'm', 3: 'M7', 4: 'o7', 5: '%7', 6: '...
  SEVEN_TYPES = [4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 18]
  SEVEN_IMPLIED_ADDITIONS = ['9', 'b9', 'b10', '13', '+9', '+11']
  IMPLIED_SEVEN_MAPPINGS = {1: 10, 2: 11, 6: 12, 7: 5, 8: 13, 14...
Properties [hide private]
  root
  root_numeral
  type
  tetrad_type
Returns the implicit or explicit tetrad type of the chord.

Inherited from object: __class__

Method Details [hide private]

__init__(self, root_numeral='C', type='', additions=None, roman=False)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

__hash__(self)
(Hashing function)

source code 

hash(x)

Overrides: object.__hash__
(inherited documentation)

_get_tetrad_type(self)

source code 

Returns the implicit or explicit tetrad type of the chord. This is the chord type, but mapped so that any 7 implicit in the additions is explicit in the type.

__str__(self)
(Informal representation operator)

source code 

str(x)

Overrides: object.__str__
(inherited documentation)

__repr__(self)
(Representation operator)

source code 

repr(x)

Overrides: object.__repr__
(inherited documentation)

from_name(chord_name, roman=False, permissive=False)
Static Method

source code 

Given a string chord name, returns the Chord object corresponding to that name.

permissive allows the label to be interpreted as a roman numeral or a pitch label.


Class Variable Details [hide private]

TYPE_SYMBOLS

Value:
{1: '',
 2: 'm',
 3: 'M7',
 4: 'o7',
 5: '%7',
 6: 'aug',
 7: 'm,b5',
 8: 'b5',
...

IMPLIED_SEVEN_MAPPINGS

Value:
{1: 10, 2: 11, 6: 12, 7: 5, 8: 13, 14: 15}

Property Details [hide private]

root

Get Method:
_get_root(self)
Set Method:
_set_root(self, value)

root_numeral

Get Method:
_get_root_numeral(self)
Set Method:
_set_root_numeral(self, value)

type

Get Method:
_get_type(self)
Set Method:
_set_type(self, value)

tetrad_type

Returns the implicit or explicit tetrad type of the chord. This is the chord type, but mapped so that any 7 implicit in the additions is explicit in the type.

Get Method:
_get_tetrad_type(self) - Returns the implicit or explicit tetrad type of the chord.