Exemplo n.º 1
0
 def xtestSnippetShow(self):
     '''
     testing a fake snippet in and MusicXML out
     '''
     block1 = ['e4 f g a', 'g4 a b cc', '', 'no-cadence', '2/4']
     bs = BallataSheet()
     dummyPiece = bs.makeWork(2)
     block2 = dummyPiece.convertBlockToStreams(block1)
     unused_fpc1 = polyphonicSnippet.FrontPaddedSnippet(block2, dummyPiece)
Exemplo n.º 2
0
    def getSnippetAtPosition(self, snippetPosition, snippetType="end"):
        '''
        gets a "snippet" which is a collection of up to 3 lines of music, a timeSignature
        and a description of the cadence.

        
        >>> bs = trecento.cadencebook.BallataSheet()
        >>> accur = bs.makeWork(2)
        >>> print(accur.getSnippetAtPosition(12))
        <music21.trecento.polyphonicSnippet.FrontPaddedSnippet ...>
        '''
        
        if self.rowvalues[snippetPosition].strip() != "":
            thisBlock = self.rowvalues[snippetPosition:snippetPosition+5]
            if thisBlock[4].strip() == "":
                if self.timeSigBegin == "":
                    return None  ## need a timesig
                thisBlock[4] = self.timeSigBegin
            blockOut = self.convertBlockToStreams(thisBlock)
            if snippetType == 'begin':
                return polyphonicSnippet.Incipit(blockOut, self)
            else:
                return polyphonicSnippet.FrontPaddedSnippet(blockOut, self)