.. _moduleTrecento.tonality:

music21.trecento.tonality
=========================

.. WARNING: DO NOT EDIT THIS FILE: AUTOMATICALLY GENERATED. Edit the .py file directly

.. module:: music21.trecento.tonality


These functions show how music21 can be used to analyze whether the idea
of tonal closure applies in the music of the Italian fourteenth century
by seeing how often the first note of the tenor (or the given voice stream
number) and the last note of that same voice are the same note.

The script also demonstrates the PNG generating abilities of the software,
etc.

Note that when the tests are run they just check that the program does not
crash -- the numbers are not checked because the underlying data is changing
too often.




.. function:: anonBallataTonality(show=True)


    Gives a list of all anonymous ballate with their incipit tenor note and cadence tenor notes
    keeps track of how often they are the same and how often they are different.

    And then generates a PNG of the incipit and first cadence of all the ones that are the same.




.. function:: landiniTonality(show=True)


    generates information about the tonality of Landini's ballate using
    the tenor (streamName = "T") and the A cadence (which we would believe
    would end the piece)




.. function:: nonLandiniTonality(show=True)


    generates information about the tonality of not anonymous ballate
    that are not by Francesco (Landini) using
    the tenor (streamName = "T") and the A cadence (which we would believe
    would end the piece)



    >>> from music21 import *
    >>> trecento.tonality.nonLandiniTonality(show = True)


    Prints something like this::


                     Deduto sey a quel    C    F
                      A pianger l'ochi    C    D
                  Con dogliosi martire    E    D
              De[h], vogliateme oldire    C    G
                Madonna, io me ramento    C    D
                          Or tolta pur    F    A
                    I' senti' matutino    G    C
                         Ad ogne vento    C    C
                  ...
                  etc...
                  ...
                Donna, perche mi veggi    G    D
             Lasso! grav' è 'l partire    F    F
                          La vaga luce    G    F
                Lena virtù et sperança    F    D
                         Ma' ria avere    C    F
                    Non c'è rimasa fe'    G    D
                        Or sie che può    G    D
                       Perchè vendetta    F    D
                  Perch'i' non sep(p)i    G    D
                 Poc' [h]anno di mirar    F    D
                 S'amor in cor gentile    F    C
                    Se per virtù amor,    C    G
                       Sofrir m'estuet    A    C
                     Una cosa di veder    G    D
                  Vago et benigno amor    G    D
                         L'adorno viso    C    G
                       Già molte volte    G    C
                  O me! al cor dolente    D    D
                Benchè lontan mi trovi    A    D
                   Dicovi per certança    G    G
               Ferito già d'un amoroso    A    D
                      Movit' a pietade    D    D
                       Non voler donna    A    D
              Sol mi trafig(g)e 'l cor    C    C
                 Se le lagrime antique    F    F
        ****    A    A    1
                A    C    3
                A    D   15
                A diff   18
                B    F    1
                B diff    1
                C    A    1
        ****    C    C   10
                C    D    4
                C    F    2
                C    G    4
                C diff   11
                D    A    1
                D    C    6
        ****    D    D   16
                D    F    4
                D    G   10
                D diff   21
                E    C    2
                E    D    1
                E    F    1
                E diff    4
                F    A    2
                F    B    1
                F    C    3
                F    D    8
        ****    F    F   11
                F    G    4
                F diff   18
                G    A    1
                G    B    1
                G    C   12
                G    D   15
                G    E    1
                G    F    1
        ****    G    G   11
                G diff   31
        Total Same   49 32.0%
        Total Diff  104 68.0%





.. function:: ph(h={})


.. function:: sacredTonality(show=True)


    Gives a list of all sacred pieces by incipit tenor note and last cadence tenor note
    and then notices which are the same and which are different.


    note that we only have a very very few sacred pieces encoded at this point so
    the results are NOT statistically significant, but it's very fast for testing.





.. function:: testAll(show=True, fast=False)


TonalityCounter
---------------



.. class:: TonalityCounter(worksList, streamName='T', cadenceName='A')


    The TonalityCounter object takes a list of Trecento Works
    (defined in music21.trecento.cadencebook) and when run()
    is called, stores a set of information about the cadence
    tonalities of the works.


    streamName can be "C" (cantus), "T" (tenor, default), or "Ct"
    (contratenor), or very rarely "4" (fourth voice).


    cadenceName can be "A" or "B" (which by default uses the
    second ending of cadence B if there are two endings) or
    an integer specifying which cadence to consult (-1 being
    the last one coded.  Useful for sacred music where we
    want the Amen no matter how many internal cadences there
    are).


    This example takes three ballata and how that all three of
    them cadence on a different note than they began on.  All
    three cadence on D despite beginning on C, A, and B (or B
    flat) repsectively.




    >>> from music21.trecento import cadencebook
    >>> threeBallata = cadencebook.BallataSheet()[15:18]
    >>> tc1 = TonalityCounter(threeBallata)
    >>> tc1.run()
    >>> print tc1.output
                        Bench'amar    C    D
                    Bench'I' serva    A    D
              Checc' a tte piaccia    B    D
            A    D    1
            A diff    1
            B    D    1
            B diff    1
            C    D    1
            C diff    1
            D diff    0
            E diff    0
            F diff    0
            G diff    0
    Total Same    0 0.0%
    Total Diff    3 100.0%
    <BLANKLINE>



    **TonalityCounter** **methods**

        .. method:: run()

            No documentation.



