[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: musicxml2ly patch: Convert articulations (fermata, staccato, tremolo
From: |
Han-Wen Nienhuys |
Subject: |
Re: musicxml2ly patch: Convert articulations (fermata, staccato, tremolo, etc.) |
Date: |
Sat, 18 Aug 2007 10:23:02 -0300 |
User-agent: |
Thunderbird 2.0.0.5 (X11/20070719) |
Reinhold Kainhofer escreveu:
> Attached is a git diff to translate articulations from MusicXML to lilypond.
> It's basically the patch from yesterday with a few style-fixes as requested
> by Han-Wen.
>
> Cheers,
> Reinhold
>
> PS: If anyone needs an ubuntu package for guile 1.8.2, I have built one to be
> able to build lilypond.
>
+ def direction_mod (self):
+ dirstr = ''
+ try:
+ dirstr += { 1: '^', -1: '_', 0: '-' }[self.force_direction]
+ except KeyError:
+ pass
+ return dirstr
use {}.get (..)
+def musicxml_direction_to_indicator (direction):
+ returnval = None
+ try:
+ val = { "above": 1, "upright": 1, "below": -1, "downright": -1
}[direction];
idem
+ str += ':%s' % 2**( 2 + string.atoi (self.bars) )
no space inside ( )
+ try:
+ dir = musicxml_direction_to_indicator (mxl_event.placement)
+ #dir = mxl_event.type
+ if ( dir ):
+ ev.force_direction = dir
+ except (KeyError, ValueError, AttributeError):
+ pass
+ return ev
don't use except() for control flow. exceptions are for exceptional situations
only
This programming style can easily hide programming errors.
also, no spaces inside ( ) , and no () around the if condition.
--
Han-Wen Nienhuys - address@hidden - http://www.xs4all.nl/~hanwen