本文整理汇总了Python中pymei.MeiElement.facs方法的典型用法代码示例。如果您正苦于以下问题:Python MeiElement.facs方法的具体用法?Python MeiElement.facs怎么用?Python MeiElement.facs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pymei.MeiElement
的用法示例。
在下文中一共展示了MeiElement.facs方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _create_custos_element
# 需要导入模块: from pymei import MeiElement [as 别名]
# 或者: from pymei.MeiElement import facs [as 别名]
def _create_custos_element(self):
custos = MeiElement("custos")
# custos = mod.custos_()
# custos.id = self._idgen()
zone = self._create_zone_element()
custos.facs = zone.id
custos.addAttribute("pname", str(self.glyph['strt_pitch']))
custos.addAttribute("oct", str(self.glyph['octv']))
custos.addAttribute("facs", str(custos.facs))
return custos
示例2: _create_clef_element
# 需要导入模块: from pymei import MeiElement [as 别名]
# 或者: from pymei.MeiElement import facs [as 别名]
def _create_clef_element(self):
clef = MeiElement("clef")
# clef = mod.clef_()
# clef.id = self._idgen()
zone = self._create_zone_element()
clef.facs = zone.id
clef.addAttribute("facs", str(clef.facs))
# clef.attributes = {"line": self.glyph['strt_pos'], 'shape': self.glyph['form'][0].upper() }
clef.addAttribute("line", str(self.glyph['strt_pos']))
clef.addAttribute("shape", str(self.glyph['form'][0].upper()))
lg.debug("clef:{0}".format(clef))
return clef
示例3: _create_neume_element
# 需要导入模块: from pymei import MeiElement [as 别名]
# 或者: from pymei.MeiElement import facs [as 别名]
def _create_neume_element(self):
full_width_episema = False
has_dot = False
has_vertical_episema = False
has_horizontal_episema = False
has_quilisma = False
this_neume_form = None
local_horizontal_episema = None
start_octave = self.glyph['octv']
clef_pos = self.glyph['clef_pos']
clef_type = self.glyph['clef'].split(".")[-1] # f or c.
# neume = mod.neume_()
neume = MeiElement("neume") # CHECK!
# neume.id = self._idgen()
zone = self._create_zone_element()
neume.facs = zone.id
neume.addAttribute("facs", neume.facs)
# neumecomponent = mod.nc_()
neumecomponent = MeiElement("nc") # CHECK!
# neumecomponent.id = self._idgen()
neume.addChild(neumecomponent)
if self.glyph['form'][0] == "he":
full_width_episema = True
del self.glyph['form'][0]
# we've removed any global he's, so
# any leftovers should be local.
if 'he' in self.glyph['form']:
has_horizontal_episema = True
if 'dot' in self.glyph['form']:
has_dot = True
if 'q' in self.glyph['form']:
has_quilisma = True
if 've' in self.glyph['form']:
has_vertical_episema = True
if 'inclinatum' in self.glyph['form']:
# neumecomponent.attributes = {'inclinatum': 'true'}
neumecomponent.addAttribute("inclinatum", "true")
# neume.attributes = {'name': self.glyph['form'][0]}
neume.addAttribute("name", str(self.glyph['form'][0]))
if 'compound' in self.glyph['form']:
# do something and create a new set of pitch contours
this_neume_form = [y for y in (self.__parse_contour(n) for n in self.glyph['form']) if y]
self._note_elements = [y for y in (self.__parse_steps(n) for n in self.glyph['form']) if y]
else:
this_neume_form = copy.deepcopy(self.NEUME_NOTES[self.glyph['form'][0]])
self._note_elements = self.glyph['form'][1:]
# get the form so we can find the number of notes we need to construct.
num_notes = len(this_neume_form) + 1
# we don't have an off-by-one problem here, since an added interval means an added note
check_additional = [i for i in self.ADD_NOTES.keys() if i in self.glyph['form'][1:]]
if check_additional:
for f in check_additional:
this_neume_form.extend(self.ADD_NOTES[f])
## THIS SHOULD BE CHANGED. Otherwise we may end up with two attributes with the
# same name.
neume.addAttribute("variant", str(f))
num_notes = num_notes + len(check_additional)
self._neume_pitches = []
# note elements are everything after the first form. This determines the shape a note takes.
self._neume_pitches.append(self.glyph['strt_pitch'])
nc = []
note_octaves = [start_octave]
if num_notes > 1:
# we need to figure out the rest of the pitches in the neume.
ivals = [int(d) for d in self._note_elements if d.isdigit()]
idx = self.SCALE.index(self.glyph['strt_pitch'])
if len(ivals) != (num_notes - 1):
if 'scandicus' in self.glyph['form']:
diffr = abs(len(ivals) - (num_notes - 1))
num_notes = num_notes + diffr
this_neume_form.extend(diffr * 'u')
else:
raise AomrMeiNoteIntervalMismatchError("There is a mismatch between the number of notes and number of intervals.")
# note elements = torculus.2.2.he.ve
# ivals = [2,2]
# torculus = ['u','d']
this_pos = copy.deepcopy(self.glyph['strt_pos'])
for n in xrange(len(ivals)):
# get the direction
dir = this_neume_form[n]
iv = ivals[n]
n_idx = idx
if dir == "u":
n_idx = ((idx + iv) % len(self.SCALE)) - 1
#.........这里部分代码省略.........