Previous topic

music21.trecento.notation

Next topic

music21.trecento.quodJactatur

Table Of Contents

Table Of Contents

This Page

music21.trecento.polyphonicSnippet

FrontPaddedSnippet

class music21.trecento.polyphonicSnippet.FrontPaddedSnippet(fiveExcelCells=None, parentPiece=None)

FrontPaddedSnippet bases

FrontPaddedSnippet read-only properties

Read-only properties inherited from Score:

Read-only properties inherited from Stream:

Read-only properties inherited from Music21Object:

FrontPaddedSnippet read/write properties

Read/write properties inherited from Stream:

Read/write properties inherited from Music21Object:

FrontPaddedSnippet methods

FrontPaddedSnippet.frontPadLine(thisStream)

Pads a line with a bunch of rests at the front to make it the same length as the longest line

>>> ts = meter.TimeSignature('1/4')
>>> s1 = stream.Part([ts])
>>> s1.repeatAppend(note.QuarterNote(), 4)
>>> s2 = stream.Part([ts])
>>> s2.repeatAppend(note.QuarterNote(), 2)
>>> s3 = stream.Part([ts])
>>> s3.repeatAppend(note.QuarterNote(), 1)
>>> fiveExcelRows = [s1, s2, s3, '', '1/4']
>>> ps = trecento.polyphonicSnippet.FrontPaddedSnippet(fiveExcelRows)
>>> ps.frontPadLine(s2)
>>> s2.show('text')
{0.0} <music21.stream.Measure 1 offset=0.0>
    {0.0} <music21.clef.TrebleClef>
    {0.0} <music21.meter.TimeSignature 1/4>
    {0.0} <music21.note.Rest rest>
{1.0} <music21.stream.Measure 2 offset=1.0>
    {0.0} <music21.note.Rest rest>
{2.0} <music21.stream.Measure 3 offset=2.0>
    {0.0} <music21.note.Note C>
{3.0} <music21.stream.Measure 4 offset=3.0>
    {0.0} <music21.note.Note C>
    {1.0} <music21.bar.Barline style=final>

Methods inherited from PolyphonicSnippet:

Methods inherited from Score:

Methods inherited from Stream:

Methods inherited from Music21Object:

FrontPaddedSnippet instance variables

FrontPaddedSnippet.autoSort

Boolean describing whether the Stream is automatically sorted by offset whenever necessary.

FrontPaddedSnippet.definesExplicitPageBreaks

Boolean that says whether all page breaks in the piece are explicitly defined. Only used on musicxml output (maps to the musicxml <supports attribute=”new-page”> tag) and only if this is the outermost Stream being shown

FrontPaddedSnippet.definesExplicitSystemBreaks

Boolean that says whether all system breaks in the piece are explicitly defined. Only used on musicxml output (maps to the musicxml <supports attribute=”new-system”> tag) and only if this is the outermost Stream being shown

FrontPaddedSnippet.flattenedRepresentationOf

When this flat Stream is derived from another non-flat stream, a reference to the source Stream is stored here.

FrontPaddedSnippet.isFlat

Boolean describing whether this Stream contains embedded sub-Streams or Stream subclasses (not flat).

FrontPaddedSnippet.isSorted

Boolean describing whether the Stream is sorted or not.

Instance variables inherited from PolyphonicSnippet:

Instance variables inherited from Score:

Instance variables inherited from Stream:

Instance variables inherited from Music21Object:

Incipit

class music21.trecento.polyphonicSnippet.Incipit(fiveExcelCells=None, parentPiece=None)

Incipit bases

Incipit read-only properties

Read-only properties inherited from Score:

Read-only properties inherited from Stream:

Read-only properties inherited from Music21Object:

Incipit read/write properties

Read/write properties inherited from Stream:

Read/write properties inherited from Music21Object:

Incipit methods

Incipit.backPadLine(thisStream)

Pads a Stream with a bunch of rests at the end to make it the same length as the longest line

>>> ts = meter.TimeSignature('1/4')
>>> s1 = stream.Part([ts])
>>> s1.repeatAppend(note.QuarterNote(), 4)
>>> s2 = stream.Part([ts])
>>> s2.repeatAppend(note.QuarterNote(), 2)
>>> s3 = stream.Part([ts])
>>> s3.repeatAppend(note.QuarterNote(), 1)
>>> fiveExcelRows = [s1, s2, s3, '', '1/4']
>>> ps = trecento.polyphonicSnippet.Incipit(fiveExcelRows)
>>> ps.backPadLine(s2)
>>> s2.show('text')
{0.0} <music21.stream.Measure 1 offset=0.0>
    {0.0} <music21.clef.TrebleClef>
    {0.0} <music21.meter.TimeSignature 1/4>
    {0.0} <music21.note.Note C>
{1.0} <music21.stream.Measure 2 offset=1.0>
    {0.0} <music21.note.Note C>
{2.0} <music21.stream.Measure 3 offset=2.0>
    {0.0} <music21.note.Rest rest>
{3.0} <music21.stream.Measure 4 offset=3.0>
    {0.0} <music21.note.Rest rest>
    {1.0} <music21.bar.Barline style=final>

Methods inherited from PolyphonicSnippet:

Methods inherited from Score:

Methods inherited from Stream:

Methods inherited from Music21Object:

Incipit instance variables

Incipit.autoSort

Boolean describing whether the Stream is automatically sorted by offset whenever necessary.

Incipit.definesExplicitPageBreaks

Boolean that says whether all page breaks in the piece are explicitly defined. Only used on musicxml output (maps to the musicxml <supports attribute=”new-page”> tag) and only if this is the outermost Stream being shown

Incipit.definesExplicitSystemBreaks

Boolean that says whether all system breaks in the piece are explicitly defined. Only used on musicxml output (maps to the musicxml <supports attribute=”new-system”> tag) and only if this is the outermost Stream being shown

Incipit.flattenedRepresentationOf

When this flat Stream is derived from another non-flat stream, a reference to the source Stream is stored here.

Incipit.isFlat

Boolean describing whether this Stream contains embedded sub-Streams or Stream subclasses (not flat).

Incipit.isSorted

Boolean describing whether the Stream is sorted or not.

Instance variables inherited from PolyphonicSnippet:

Instance variables inherited from Score:

Instance variables inherited from Stream:

Instance variables inherited from Music21Object:

PolyphonicSnippet

class music21.trecento.polyphonicSnippet.PolyphonicSnippet(fiveExcelCells=None, parentPiece=None)

A polyphonic snippet is a little Score-ette that represents an incipit or a cadence or something of that sort of a piece

It is initialized with the contents of five excel cells – the first three represent the notation of the cantus, tenor, and contratenor, respectively.

The fourth is the cadence type (optional), the fifth is the time signature if not the same as the time signature of the parentPiece.

>>> cantus = trecento.trecentoCadence.TrecentoCadenceStream("c'2. d'8 c'4 a8 f4 f8 a4 c'4 c'8", '6/8')
>>> tenor = trecento.trecentoCadence.TrecentoCadenceStream("F1. f2. e4. d", '6/8')
>>> ps = trecento.polyphonicSnippet.PolyphonicSnippet([cantus, tenor, None, "8-8", "6/8"], parentPiece = trecento.cadencebook.BallataSheet().makeWork(3))
>>> ps.elements
(<music21.metadata.Metadata object at 0x...>, <music21.stream.Part C>, <music21.stream.Part T>)
>>> ps.elements[1] is cantus
True
>>> ps.elements[1].classes
['Part', 'TrecentoCadenceStream', 'TinyNotationStream', 'Stream', 'Music21Object', 'object']
>>> ps.show()
../_images/trecento-polyphonicSnippet1.png

PolyphonicSnippet bases

PolyphonicSnippet read-only properties

Read-only properties inherited from Score:

Read-only properties inherited from Stream:

Read-only properties inherited from Music21Object:

PolyphonicSnippet read/write properties

Read/write properties inherited from Stream:

Read/write properties inherited from Music21Object:

PolyphonicSnippet methods

PolyphonicSnippet.findLongestCadence()

returns the length. (in quarterLengths) for the longest line in the parts

>>> s1 = stream.Part([note.WholeNote()])
>>> s2 = stream.Part([note.HalfNote()])
>>> s3 = stream.Part([note.QuarterNote()])
>>> fiveExcelRows = [s1, s2, s3, '', '2/2']
>>> ps = trecento.polyphonicSnippet.PolyphonicSnippet(fiveExcelRows)
>>> ps.findLongestCadence()
4.0
PolyphonicSnippet.header()

returns a string that prints an appropriate header for this cadence

PolyphonicSnippet.measuresShort(thisStream)

returns the number of measures short that each stream is compared to the longest stream.

>>> s1 = stream.Part([note.WholeNote()])
>>> s2 = stream.Part([note.HalfNote()])
>>> s3 = stream.Part([note.QuarterNote()])
>>> fiveExcelRows = [s1, s2, s3, '', '1/2']
>>> ps = trecento.polyphonicSnippet.PolyphonicSnippet(fiveExcelRows)
>>> ps.findLongestCadence()
4.0
>>> ps.measuresShort(s2)
1.0
>>> ps.measuresShort(s3)
1.5
>>> ps.measuresShort(s1)
0.0

Methods inherited from Score:

Methods inherited from Stream:

Methods inherited from Music21Object:

PolyphonicSnippet instance variables

PolyphonicSnippet.autoSort

Boolean describing whether the Stream is automatically sorted by offset whenever necessary.

PolyphonicSnippet.definesExplicitPageBreaks

Boolean that says whether all page breaks in the piece are explicitly defined. Only used on musicxml output (maps to the musicxml <supports attribute=”new-page”> tag) and only if this is the outermost Stream being shown

PolyphonicSnippet.definesExplicitSystemBreaks

Boolean that says whether all system breaks in the piece are explicitly defined. Only used on musicxml output (maps to the musicxml <supports attribute=”new-system”> tag) and only if this is the outermost Stream being shown

PolyphonicSnippet.flattenedRepresentationOf

When this flat Stream is derived from another non-flat stream, a reference to the source Stream is stored here.

PolyphonicSnippet.isFlat

Boolean describing whether this Stream contains embedded sub-Streams or Stream subclasses (not flat).

PolyphonicSnippet.isSorted

Boolean describing whether the Stream is sorted or not.

Instance variables inherited from Score:

Instance variables inherited from Stream:

Instance variables inherited from Music21Object: