[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Lilypond-auto] Issue 3486 in lilypond: musicxml2ly: add support for col
From: |
lilypond |
Subject: |
[Lilypond-auto] Issue 3486 in lilypond: musicxml2ly: add support for color attributes of noteheads and stems |
Date: |
Sun, 04 Aug 2013 10:19:20 +0000 |
Status: Accepted
Owner: ----
Labels: Type-Enhancement
New issue 3486 by address@hidden: musicxml2ly: add support for color
attributes of noteheads and stems
http://code.google.com/p/lilypond/issues/detail?id=3486
Patch proposed by DaLa:
http://lists.gnu.org/archive/html/bug-lilypond/2013-07/msg00128.html
Yesterday I colored some noteheads in a piece of music using the format
musicxml.
I learned: the format musicxml supports color attributes for noteheads and
stems.
Unfortunately the script musicxml2ly.py in lilypond version 2.16.2-1 seems
to ignore color attributes of noteheads and stems.
I therefore would like to recommend the following changes in the scripts
* musicxml2ly.py
* musicexp.py
I have made some simple tests - the changes seem to work. Maybe some
additional regression tests are necessary. (and: I'm not familiar with the
methods pre_note_ly of the Event classes - must they consider the color
attribute? I don't know.)
Thank You
DaLa
- - -
[musicxml2ly.py, line 1610]
def musicxml_notehead_to_lily (nh): #function changed: additionally process
color attribute
styles = []
# Notehead style
style = notehead_styles_dict.get (nh.get_text ().strip (), None)
style_elm = musicexp.NotestyleEvent ()
if style:
style_elm.style = style
if hasattr (nh, 'filled'):
style_elm.filled = (getattr (nh, 'filled') == "yes")
if hasattr (nh, 'color'):
style_elm.color = hex_to_color (getattr (nh, 'color'))
if style_elm.style or (style_elm.filled != None) or (style_elm.color !=
None):
styles.append (style_elm)
# parentheses
if hasattr (nh, 'parentheses') and (nh.parentheses == "yes"):
styles.append (musicexp.ParenthesizeEvent ())
return styles
def musicxml_stem_to_lily (st): #function added: process stem color
attribute
styles = []
# Stem style
style_elm = musicexp.StemstyleEvent ()
if hasattr (st, 'color'):
style_elm.color = hex_to_color (getattr (st, 'color'))
if (style_elm.color != None):
styles.append (style_elm)
return styles
[musicexp.py, line 1247]
class NotestyleEvent (Event): #class changed: additional attribute color
def __init__ (self):
Event.__init__ (self)
self.style = None
self.filled = None
self.color = None
def pre_chord_ly (self):
return_string = ''
if self.style:
return_string += " \\once \\override NoteHead #'style = #%s" %
self.style
if self.color:
return_string += " \\once \\override NoteHead #'color =
#(rgb-color %s %s %s)" % (self.color[0], self.color[1], self.color[2])
return return_string
def pre_note_ly (self, is_chord_element):
if self.style and is_chord_element:
return "\\tweak #'style #%s" % self.style
else:
return ''
def ly_expression (self):
return self.pre_chord_ly ()
class StemstyleEvent (Event): #class added
def __init__ (self):
Event.__init__ (self)
self.color = None
def pre_chord_ly (self):
if self.color:
return "\\once \\override Stem #'color = #(rgb-color %s %s %s)"
% (self.color[0], self.color[1], self.color[2])
else:
return ''
def pre_note_ly (self, is_chord_element):
return ''
def ly_expression (self):
return self.pre_chord_ly ()
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Lilypond-auto] Issue 3486 in lilypond: musicxml2ly: add support for color attributes of noteheads and stems,
lilypond <=