当前位置: 首页>>代码示例>>Python>>正文


Python corpus.getWork函数代码示例

本文整理汇总了Python中music21.corpus.getWork函数的典型用法代码示例。如果您正苦于以下问题:Python getWork函数的具体用法?Python getWork怎么用?Python getWork使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了getWork函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: testBasic

    def testBasic(self):
        from music21 import converter, corpus

        a = converter.parse(corpus.getWork('haydn/opus74no2/movement4.xml'))
        post = assembleLyrics(a)
        self.assertEqual(post, '') # no lyrics!

        a = converter.parse(corpus.getWork('luca/gloria'))
        post = assembleLyrics(a)
        self.assertEqual(post.startswith('Et in terra pax hominibus bone voluntatis'), True) 
开发者ID:bewest,项目名称:music21-bewest.clone,代码行数:10,代码来源:text.py

示例2: testHandelImport

 def testHandelImport(self):
     # can get a single file just by file name
     unused_fp = corpus.getWork('hwv56/movement1-01')#
     fpCollection = corpus.getComposer('handel')
     self.assertEqual(len(fpCollection) >= 1, True)
     fpCollection = corpus.getComposer('handel', ['md'])
     self.assertEqual(len(fpCollection) >= 1, True)
开发者ID:ABC-B,项目名称:music21,代码行数:7,代码来源:testCorpus.py

示例3: testDesPrezImport

 def testDesPrezImport(self):
     # can get a single file just by file name
     filePath = corpus.getWork("fortunaDunGranTempo")
     filePath = re.sub(r"\\", "/", filePath)
     self.assertEqual(filePath.endswith("josquin/fortunaDunGranTempo.abc"), True)
     filePathCollection = corpus.getComposer("josquin")
     self.assertEqual(len(filePathCollection) >= 8, True)
     filePathCollection = corpus.getComposer("josquin", ["abc"])
     self.assertEqual(len(filePathCollection) >= 8, True)
开发者ID:fzalkow,项目名称:music21,代码行数:9,代码来源:testCorpus.py

示例4: testDesPrezImport

 def testDesPrezImport(self):
     # can get a single file just by file name
     filePath = str(corpus.getWork('fortunaDunGranTempo'))
     filePath = re.sub(r'\\', '/', filePath)
     self.assertEqual(filePath.endswith('josquin/fortunaDunGranTempo.abc'), True)
     filePathCollection = corpus.getComposer('josquin')
     self.assertEqual(len(filePathCollection) >= 8, True)
     filePathCollection = corpus.getComposer('josquin', ['abc'])
     self.assertEqual(len(filePathCollection) >= 8, True)
开发者ID:cuthbertLab,项目名称:music21,代码行数:9,代码来源:testCorpus.py

示例5: testEssenImport

 def testEssenImport(self):
     # can get a single file just by file name
     filePath = corpus.getWork('altdeu10')
     self.assertEqual(filePath.name, 'altdeu10.abc')
     self.assertEqual(filePath.parent.name, 'essenFolksong')
     filePathCollection = corpus.getComposer('essenFolksong')
     self.assertEqual(len(filePathCollection), 31)
     filePathCollection = corpus.getComposer('essenFolksong', ['abc'])
     self.assertEqual(len(filePathCollection), 31)
开发者ID:cuthbertLab,项目名称:music21,代码行数:9,代码来源:testCorpus.py

示例6: testEssenImport

 def testEssenImport(self):
     # can get a single file just by file name
     filePath = corpus.getWork('altdeu10')
     self.assertTrue(filePath.endswith('essenFolksong/altdeu10.abc') or
         filePath.endswith(r'essenFolksong\altdeu10.abc'))
     filePathCollection = corpus.getComposer('essenFolksong')
     self.assertEqual(len(filePathCollection), 31)
     filePathCollection = corpus.getComposer('essenFolksong', ['abc'])
     self.assertEqual(len(filePathCollection), 31)
开发者ID:EQ4,项目名称:music21,代码行数:9,代码来源:testCorpus.py

示例7: testEssenImport

 def testEssenImport(self):
     # can get a single file just by file name
     filePath = corpus.getWork("altdeu10")
     self.assertTrue(
         filePath.endswith("essenFolksong/altdeu10.abc") or filePath.endswith(r"essenFolksong\altdeu10.abc")
     )
     filePathCollection = corpus.getComposer("essenFolksong")
     self.assertEqual(len(filePathCollection), 31)
     filePathCollection = corpus.getComposer("essenFolksong", ["abc"])
     self.assertEqual(len(filePathCollection), 31)
开发者ID:fzalkow,项目名称:music21,代码行数:10,代码来源:testCorpus.py

示例8: testGetPaths

 def testGetPaths(self):
     for known in [
         "schumann_clara/opus17/movement3.xml",
         "schoenberg/opus19/movement2.mxl",
         "palestrina/agnus_0.krn",
     ]:
         a = corpus.getWork(known)
         # make sure it is not an empty list
         self.assertNotEqual(len(a), 0)
         workSlashes = re.sub(r"\\", "/", a)
         self.assertTrue(workSlashes.lower().endswith(known.lower()), (workSlashes, known))
开发者ID:fzalkow,项目名称:music21,代码行数:11,代码来源:testCorpus.py

示例9: testGetPaths

 def testGetPaths(self):
     for known in [
             'schumann_clara/opus17/movement3.xml',
             'schoenberg/opus19/movement2.mxl',
             'palestrina/agnus_02.krn',
         ]:
         a = corpus.getWork(known)
         # make sure it is not an empty list
         self.assertTrue(a)
         workSlashes = re.sub(r'\\', '/', str(a))
         self.assertTrue(workSlashes.lower().endswith(known.lower()), (workSlashes, known))
开发者ID:cuthbertLab,项目名称:music21,代码行数:11,代码来源:testCorpus.py

示例10: testGetPaths

 def testGetPaths(self):
     for known in ['haydn/opus74no2/movement4.mxl',
         'beethoven/opus18no3.mxl',
         'beethoven/opus59no1/movement2.mxl',
         'mozart/k80/movement4.mxl',
         'schumann/opus41no1/movement5.mxl',
         ]:
         a = corpus.getWork(known)
         # make sure it is not an empty list
         self.assertNotEqual(len(a), 0)
         workSlashes = re.sub(r'\\', '/', a)
         self.assertEqual(workSlashes.endswith(known), True)
开发者ID:ABC-B,项目名称:music21,代码行数:12,代码来源:testCorpus.py

示例11: simple4g

def simple4g():
    # question 62: Determine how often a pitch is followed immediately by the same pitch
    work = 'opus18no1'
    movements = corpus.getWork(work)
    movementNumber = 3
    s = converter.parse(movements[movementNumber-1])
    count = 0
    for part in s:
        noteStream = part.flat.getElementsByClass(note.Note)
        for i in range(len(noteStream)-1):
            # assuming spelling does not count
            if noteStream[i].midi == noteStream[i+1].midi:
                count += 1
    print('repeated pitches for %s, movement %s: %s counts' % (work,
                     movementNumber, count))
开发者ID:00gavin,项目名称:music21,代码行数:15,代码来源:seaverOct2009.py

示例12: testOpusImport

    def testOpusImport(self):
        from music21 import corpus
        from music21 import abcFormat

        # replace w/ ballad80, smaller or erk5
        fp = corpus.getWork('essenFolksong/teste')
        self.assertTrue(fp.endswith('essenFolksong/teste.abc') or fp.endswith(r'essenFolksong\teste.abc'))

        af = abcFormat.ABCFile()
        af.open(fp) # return handler, processes tokens
        ah = af.read()
        af.close()

        op = abcToStreamOpus(ah)
        #op.scores[3].show()
        self.assertEqual(len(op), 8)
开发者ID:antoniopessotti,项目名称:music21,代码行数:16,代码来源:translate.py


注:本文中的music21.corpus.getWork函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。