def test_tonalanalysistools_RootlessChordClass___init___02(): r'''Initialize seventh and ninth. ''' cqi = tonalanalysistools.RootlessChordClass('dominant', 7, 'root') assert str(cqi) == '<P1, +M3, +P5, +m7>' cqi = tonalanalysistools.RootlessChordClass('dominant', 9, 'root') assert str(cqi) == '<P1, +M3, +P5, +m7, +M9>'
def test_tonalanalysistools_RootlessChordClass___init___01(): r'''Initialize root position triad. ''' cqi = tonalanalysistools.RootlessChordClass('major', 'triad') assert str(cqi) == '<P1, +M3, +P5>' cqi = tonalanalysistools.RootlessChordClass('minor', 'triad') assert str(cqi) == '<P1, +m3, +P5>' cqi = tonalanalysistools.RootlessChordClass('diminished', 'triad') assert str(cqi) == '<P1, +m3, +dim5>' cqi = tonalanalysistools.RootlessChordClass('augmented', 'triad') assert str(cqi) == '<P1, +M3, +aug5>'
def test_tonalanalysistools_RootlessChordClass___init___03(): r'''Initialize with quality string and integer cardinality. ''' cqi = tonalanalysistools.RootlessChordClass('dominant', 7) assert str(cqi) == '<P1, +M3, +P5, +m7>' cqi = tonalanalysistools.RootlessChordClass('major', 7) assert str(cqi) == '<P1, +M3, +P5, +M7>' cqi = tonalanalysistools.RootlessChordClass('diminished', 7) assert str(cqi) == '<P1, +m3, +dim5, +dim7>' cqi = tonalanalysistools.RootlessChordClass('dominant', 9) assert str(cqi) == '<P1, +M3, +P5, +m7, +M9>'
def __init__( self, root=None, quality_string='major', extent='triad', inversion='root', ): import abjad from abjad.tools import tonalanalysistools root = root or 'c' root = abjad.NamedPitchClass(root) chord_quality = tonalanalysistools.RootlessChordClass( quality_string=quality_string, extent=extent, inversion=inversion, ) npcs = [] for hdi in chord_quality: mdi = abjad.NamedInterval(hdi) npc = root + mdi npcs.append(npc) bass = npcs[0] PitchClassSet.__init__( self, items=npcs, item_class=abjad.NamedPitchClass, ) self._root = root self._chord_quality = chord_quality self._bass = bass
def __init__(self, root=None, *args): from abjad.tools import tonalanalysistools root = root or 'c' root = pitchtools.NamedPitchClass(root) chord_quality = tonalanalysistools.RootlessChordClass(*args) npcs = [] for hdi in chord_quality: mdi = pitchtools.NamedInterval(hdi) npc = root + mdi npcs.append(npc) bass = npcs[0] PitchClassSet.__init__( self, items=npcs, item_class=pitchtools.NamedPitchClass, ) self._root = root self._chord_quality = chord_quality self._bass = bass