本文整理汇总了Python中music21.common.getSourceFilePath函数的典型用法代码示例。如果您正苦于以下问题:Python getSourceFilePath函数的具体用法?Python getSourceFilePath怎么用?Python getSourceFilePath使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getSourceFilePath函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getPaths
def getPaths(self):
documentationDirectoryPath = os.path.join(common.getSourceFilePath(), 'documentation')
self.documentationDirectoryPath = documentationDirectoryPath
self.autogenDirectoryPath = os.path.join(
documentationDirectoryPath,
'autogenerated',
)
self.buildDirectoryPath = os.path.join(
documentationDirectoryPath,
'build',
)
self.doctreesDirectoryPath = os.path.join(
self.buildDirectoryPath,
'doctrees',
)
self.buildDirectories = {
'html': os.path.join(
self.buildDirectoryPath,
'html',
),
'latex': os.path.join(
self.buildDirectoryPath,
'latex',
),
# could reuse latex, but too much rewriting
'latexpdf': os.path.join(
self.buildDirectoryPath,
'latex',
),
}
示例2: testPaert
def testPaert(self):
import os
nwcTranslatePath = common.getSourceFilePath() + os.path.sep + 'noteworthy'
paertPath = nwcTranslatePath + os.path.sep + 'NWCTEXT_Really_complete_example_file.nwctxt' #'Part_OWeisheit.nwctxt' #
#paertPath = r'D:\docs\research\music21\elvis\Wegman Masses\01\Caput\01 Kyrie.nwctxt'
myScore = NoteworthyTranslator().parseFile(paertPath)
myScore.show()
示例3: testMIDIParse
def testMIDIParse():
from music21 import converter, common
from music21 import freezeThaw
#a = 'https://github.com/ELVIS-Project/vis/raw/master/test_corpus/prolationum-sanctus.midi'
#c = converter.parse(a)
# c = corpus.parse('bwv66.6', forceSource=True)
# v = freezeThaw.StreamFreezer(c)
# v.setupSerializationScaffold()
# return v.writeStr() # returns a string
import os
a = os.path.join(common.getSourceFilePath(),
'midi',
'testPrimitive',
'test03.mid')
#a = 'https://github.com/ELVIS-Project/vis/raw/master/test_corpus/prolationum-sanctus.midi'
c = converter.parse(a)
v = freezeThaw.StreamFreezer(c)
v.setupSerializationScaffold()
mockType = lambda x: x.__class__.__name__ == 'weakref'
ty = TreeYielder(mockType)
for val in ty.run(c):
print(val, ty.currentLevel())
示例4: testComplete
def testComplete(self):
ci = CapellaImporter()
#ci.readCapellaXMLFile(r'd:/desktop/achsorgd.capx')
capellaDirPath = common.getSourceFilePath() / 'capella'
oswaldPath = capellaDirPath / r'Nu_rue_mit_sorgen.capx'
partScore = ci.scoreFromFile(oswaldPath)
partScore.show()
示例5: testComplete
def testComplete(self):
nwcTranslatePath = common.getSourceFilePath() / 'noteworthy'
complete = nwcTranslatePath / 'NWCTEXT_Really_complete_example_file.nwctxt'
#'Part_OWeisheit.nwctxt' #
myScore = NoteworthyTranslator().parseFile(complete)
myScore.show()
示例6: __init__
def __init__(self):
self.outputDirectory = None
self.docBasePath = os.path.join(common.getSourceFilePath(), 'documentation')
self.docSourcePath = os.path.join(self.docBasePath,
'source')
self.docGeneratedPath = os.path.join(self.docBasePath,
'autogenerated')
示例7: readExcerpts
def readExcerpts(self):
for languageCode in self.languageCodes:
thisExcerpt = (common.getSourceFilePath() / 'languageExcerpts'
/ (languageCode + '.txt'))
with thisExcerpt.open(encoding='utf-8') as f:
excerptWords = f.read().split()
self.trigrams[languageCode] = Trigram(excerptWords)
示例8: readExcerpts
def readExcerpts(self):
for languageCode in self.languageCodes:
thisExcerpt = os.path.join(common.getSourceFilePath(),
'languageExcerpts',
languageCode + '.txt')
f = open(thisExcerpt)
self.trigrams[languageCode] = Trigram(f.read().split())
f.close()
示例9: testTransposingInstruments
def testTransposingInstruments(self):
import os
from music21 import converter, common
fpDir = os.path.join(common.getSourceFilePath(), 'musedata', 'testPrimitive', 'test01')
s = converter.parse(fpDir)
p = s.parts['Clarinet in A']
self.assertEqual(str(p.getElementsByClass('Measure')[0].keySignature), '<music21.key.KeySignature of 3 sharps>')
self.assertEqual(str(p.flat.notesAndRests[0]), '<music21.note.Note A>')
示例10: allFiles
def allFiles():
thisDir = common.getSourceFilePath() / 'musicxml' / 'lilypondTestSuite'
allOut = []
for f in thisDir.iterdir():
if f.name.startswith('__'):
continue
allOut.append(f)
return allOut
示例11: getDirBuildHtml
def getDirBuildHtml():
'''Return the html directory
'''
from music21 import common
cwdir = common.getSourceFilePath()
parentDir = os.path.dirname(cwdir)
dirBuild = os.path.join(parentDir, 'music21', 'documentation', 'build')
dirBuildHtml = os.path.join(dirBuild, 'html')
return dirBuildHtml
示例12: testComplete
def testComplete(self):
ci = CapellaImporter()
#ci.readCapellaXMLFile(r'd:/desktop/achsorgd.capx')
import os
from music21 import common
capellaDirPath = common.getSourceFilePath() + os.path.sep + 'capella'
oswaldPath = capellaDirPath + os.path.sep + r'Nu_rue_mit_sorgen.capx'
partScore = ci.scoreFromFile(oswaldPath)
partScore.show()
示例13: readExcerpts
def readExcerpts(self):
for languageCode in self.languageCodes:
thisExcerpt = os.path.join(common.getSourceFilePath(),
'languageExcerpts',
languageCode + '.txt')
with open(thisExcerpt) as f:
excerptWords = f.read().split()
self.trigrams[languageCode] = Trigram(excerptWords)
示例14: testBasic
def testBasic(self):
import os
from music21 import common
nwcTranslatePath = common.getSourceFilePath() + os.path.sep + 'noteworthy'
simplePath = nwcTranslatePath + os.path.sep + 'verySimple.nwctxt'#'NWCTEXT_Really_complete_example_file.nwctxt' # ## #'Part_OWeisheit.nwctxt' #
myScore = NoteworthyTranslator().parseFile(simplePath)
self.assertEqual(len(myScore.flat.notes), 1)
self.assertEqual(str(myScore.flat.notes[0].name), "E")
self.assertEqual(str(myScore.flat.getElementsByClass('Clef')[0]), "<music21.clef.BassClef>")
示例15: getDirBuildHtml
def getDirBuildHtml():
"""Return the html directory
"""
from music21 import common
cwdir = common.getSourceFilePath()
parentDir = os.path.dirname(cwdir)
dirBuild = os.path.join(parentDir, "music21", "documentation", "build")
dirBuildHtml = os.path.join(dirBuild, "html")
return dirBuildHtml