.. _moduleAnalysis.patel:

music21.analysis.patel
======================

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

.. module:: music21.analysis.patel



.. function:: melodicIntervalVariability(streamForAnalysis, *skipArgs, **skipKeywords)


    gives the Melodic Interval Variability (MIV) for a Stream,
    as defined by Aniruddh D. Patel in "Music, Language, and the Brain"
    p. 223, as 100 x the coefficient of variation (standard deviation/mean)
    of the interval size (measured in semitones) between consective elements.


    the 100x is designed to put it in the same range as nPVI


    this method takes the same arguments of skipArgs and skipKeywords as
    Stream.melodicIntervals() for determining how to find consecutive
    intervals.




    >>> from music21 import *
    >>> s2 = converter.parse('C4 D E F# G#', '4/4').notesAndRests
    >>> analysis.patel.melodicIntervalVariability(s2)
    0.0
    >>> s3 = converter.parse('C4 D E F G C', '4/4').notesAndRests
    >>> analysis.patel.melodicIntervalVariability(s3)
    85.266688...
    >>> s4 = corpus.parse('bwv66.6').parts[0].flat.notesAndRests
    >>> analysis.patel.melodicIntervalVariability(s4)
    65.287...



.. function:: nPVI(streamForAnalysis)


    Algorithm to give the normalized pairwise variability index
    (Low, Grabe, & Nolan, 2000) of the rhythm of a stream.


    Used by Aniruddh D. Patel to argue for national differences between musical
    themes.  First encountered it in a presentation by Patel, Chew, Francois,
    and Child at MIT.


    n.b. -- takes the distance between each element, including clefs, keys, etc.
    use .notesAndRests etc. to filter out elements that are not useful.


    n.b. # 2 -- duration is used rather than actual distance -- for gapless
    streams (the norm) these two measures will be identical.




    >>> from music21 import *
    >>> s2 = converter.parse('C4 D E F G', '4/4').notesAndRests
    >>> analysis.patel.nPVI(s2)
    0.0
    >>> s3 = converter.parse('C4 D8 C4 D8 C4', '4/4').notesAndRests
    >>> analysis.patel.nPVI(s3)
    66.6666...
    >>> s4 = corpus.parse('bwv66.6').parts[0].flat.notesAndRests
    >>> analysis.patel.nPVI(s4)
    12.96296...



