• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python corpus.getWork函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python corpus.parse函数代码示例发布时间:2022-05-27
下一篇:
Python converter.parseData函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap