コード例 #1
0
    def parseFile(self, fp, number=None):
        '''
        parse fp and number
        '''
        from music21 import converter
        from music21 import musedata as musedataModule
        from music21.musedata import translate as musedataTranslate

        mdw = musedataModule.MuseDataWork()

        af = converter.ArchiveManager(fp)

        #environLocal.printDebug(['ConverterMuseData: parseFile', fp, af.isArchive()])
        # for dealing with one or more files
        if fp.endswith('.zip') or af.isArchive():
            #environLocal.printDebug(['ConverterMuseData: found archive', fp])
            # get data will return all data from the zip as a single string
            for partStr in af.getData(dataFormat='musedata'):
                #environLocal.printDebug(['partStr', len(partStr)])
                mdw.addString(partStr)
        else:
            if os.path.isdir(fp):
                mdd = musedataModule.MuseDataDirectory(fp)
                fpList = mdd.getPaths()
            elif not common.isListLike(fp):
                fpList = [fp]
            else:
                fpList = fp

            for fp in fpList:
                mdw.addFile(fp)

        #environLocal.printDebug(['ConverterMuseData: mdw file count', len(mdw.files)])

        musedataTranslate.museDataWorkToStreamScore(mdw, self.stream)
コード例 #2
0
ファイル: subConverters.py プロジェクト: rmattes/music21
    def parseFile(self, fp, number=None):
        '''
        parse fp and number
        '''
        from music21 import converter
        from music21 import musedata as musedataModule
        from music21.musedata import translate as musedataTranslate

        mdw = musedataModule.MuseDataWork()

        af = converter.ArchiveManager(fp)

        #environLocal.printDebug(['ConverterMuseData: parseFile', fp, af.isArchive()])
        # for dealing with one or more files
        if fp.endswith('.zip') or af.isArchive():
            #environLocal.printDebug(['ConverterMuseData: found archive', fp])
            # get data will return all data from the zip as a single string
            for partStr in af.getData(dataFormat='musedata'):
                #environLocal.printDebug(['partStr', len(partStr)])
                mdw.addString(partStr)
        else:
            if os.path.isdir(fp):
                mdd = musedataModule.MuseDataDirectory(fp)
                fpList = mdd.getPaths()
            elif not common.isListLike(fp):
                fpList = [fp]
            else:
                fpList = fp

            for fp in fpList:
                mdw.addFile(fp)

        #environLocal.printDebug(['ConverterMuseData: mdw file count', len(mdw.files)])

        musedataTranslate.museDataWorkToStreamScore(mdw, self.stream)
コード例 #3
0
    def parseData(self, strData, number=None):
        '''Get musedata from a string representation.

        '''
        from music21 import musedata as musedataModule
        from music21.musedata import translate as musedataTranslate

        if isinstance(strData, six.string_types):
            strDataList = [strData]
        else:
            strDataList = strData

        mdw = musedataModule.MuseDataWork()

        for strData in strDataList:
            mdw.addString(strData)

        musedataTranslate.museDataWorkToStreamScore(mdw, self.stream)
コード例 #4
0
ファイル: subConverters.py プロジェクト: rmattes/music21
    def parseData(self, strData, number=None):
        '''Get musedata from a string representation.

        '''
        from music21 import musedata as musedataModule
        from music21.musedata import translate as musedataTranslate

        if isinstance(strData, six.string_types):
            strDataList = [strData]
        else:
            strDataList = strData

        mdw = musedataModule.MuseDataWork()

        for strData in strDataList:
            mdw.addString(strData)

        musedataTranslate.museDataWorkToStreamScore(mdw, self.stream)
コード例 #5
0
ファイル: subConverters.py プロジェクト: keszybz/music21
    def parseData(self, strData, number=None):
        """Get musedata from a string representation.

        """
        from music21 import musedata as musedataModule
        from music21.musedata import translate as musedataTranslate

        if common.isStr(strData):
            strDataList = [strData]
        else:
            strDataList = strData

        mdw = musedataModule.MuseDataWork()

        for strData in strDataList:
            mdw.addString(strData)

        musedataTranslate.museDataWorkToStreamScore(mdw, self.stream)