def set_file (self, file):
self._file = file
- def dump_version (self):
- self.print_verbatim ('\\version "2.19.15"')
+ def dump_version (self, version):
+ self.print_verbatim ('\\version "' + version + '"')
self.newline ()
def get_indent (self):
def pitch_catalan (pitch):
return pitch_italiano (pitch)
+def pitch_francais (pitch):
+ str = pitch_generic (pitch, ['do', 'ré', 'mi', 'fa', 'sol', 'la', 'si'], ['b', 'sb', 'sd', 'd'])
+ return str
+
def pitch_espanol (pitch):
str = pitch_generic (pitch, ['do', 're', 'mi', 'fa', 'sol', 'la', 'si'], ['b', None, None, 's'])
return str
"norsk": pitch_norsk,
"svenska": pitch_svenska,
"italiano": pitch_italiano,
+ "français": pitch_francais,
"catalan": pitch_catalan,
"espanol": pitch_espanol,
+ "español": pitch_espanol,
"vlaams": pitch_vlaams}
pitch_generating_function = function_dict.get (language, pitch_general)
def print_ly (self, func):
if self.display_bracket == None:
- func ("\\once \\override TupletBracket #'stencil = ##f")
+ func ("\\once \\omit TupletBracket")
func.newline ()
elif self.display_bracket == "curved":
ly.warning (_ ("Tuplet brackets of curved shape are not correctly implemented"))
- func ("\\once \\override TupletBracket #'stencil = #ly:slur::print")
+ func ("\\once \\override TupletBracket.stencil = #ly:slur::print")
func.newline ()
base_number_function = {None: "#f",
if self.display_type == "actual" and self.normal_type:
# Obtain the note duration in scheme-mode, i.e. \longa as \\longa
base_duration = self.normal_type.ly_expression (None, True)
- func ("\\once \\override TupletNumber #'text = #(tuplet-number::append-note-wrapper %s \"%s\")" %
+ func ("\\once \\override TupletNumber.text = #(tuplet-number::append-note-wrapper %s \"%s\")" %
(base_number_function, base_duration))
func.newline ()
elif self.display_type == "both": # TODO: Implement this using actual_type and normal_type!
if self.display_number == None:
- func ("\\once \\override TupletNumber #'stencil = ##f")
+ func ("\\once \\omit TupletNumber")
func.newline ()
elif self.display_number == "both":
den_duration = self.normal_type.ly_expression (None, True)
else:
num_duration = den_duration
if (self.display_denominator or self.display_numerator):
- func ("\\once \\override TupletNumber #'text = #(tuplet-number::non-default-fraction-with-notes %s \"%s\" %s \"%s\")" %
+ func ("\\once \\override TupletNumber.text = #(tuplet-number::non-default-fraction-with-notes %s \"%s\" %s \"%s\")" %
(self.display_denominator, den_duration,
self.display_numerator, num_duration))
func.newline ()
else:
- func ("\\once \\override TupletNumber #'text = #(tuplet-number::fraction-with-notes \"%s\" \"%s\")" %
+ func ("\\once \\override TupletNumber.text = #(tuplet-number::fraction-with-notes \"%s\" \"%s\")" %
(den_duration, num_duration))
func.newline ()
else:
if self.display_number == None:
- func ("\\once \\override TupletNumber #'stencil = ##f")
+ func ("\\once \\omit TupletNumber")
func.newline ()
elif self.display_number == "both":
- func ("\\once \\override TupletNumber #'text = #%s" % base_number_function)
+ func ("\\once \\override TupletNumber.text = #%s" % base_number_function)
func.newline ()
func ('\\times %d/%d ' %
# If a header item contains a line break, it is segmented. The
# substrings are formatted with the help of \markup, using
- # \column and \line.
- if '\n' in value:
+ # \column and \line. An exception, however, are texidoc items,
+ # which should not contain LilyPond formatting commands.
+ if (key != 'texidoc') and ('\n' in value):
value = value.replace('"', '')
printer.dump(r'\markup \column {')
substrings = value.split('\n')
if v:
self.format_header_strings(k, v, printer)
#printer.newline()
- printer.dump(r'tagline = \markup {')
- printer.newline()
- printer.dump(r' \center-column {')
- printer.newline()
- printer.dump('\line {"Music engraving by LilyPond " $(lilypond-version) | \with-url #"http://www.lilypond.org" {www.lilypond.org}}')
- printer.newline()
- printer.dump('\line {\with-url #"https://philomelos.net" {\with-color #grey {Learn, teach and share music on https://philomelos.net}}}')
- printer.newline()
- printer.dump('}')
- printer.newline()
- printer.dump('}')
- printer.newline()
printer.dump("}")
printer.newline()
printer.newline()
printer.newline ()
printer.dump ('\\paper {')
printer.newline ()
- printer.dump ("markup-system-spacing #'padding = #2")
printer.newline ()
self.print_length_field (printer, "paper-width", self.page_width)
self.print_length_field (printer, "paper-height", self.page_height)
"wavy" : "zigzag"
}. get (self.line_type, None)
if style:
- printer.dump ("\\once \\override Glissando #'style = #'%s" % style)
+ printer.dump ("\\once \\override Glissando.style = #'%s" % style)
def ly_expression (self):
return {-1: '\\glissando',
1:''}.get (self.span_direction, '')
return { 1: '^', -1: '_', 0: '-' }.get (self.force_direction, '-')
def ly_expression (self):
- base_string = '%s\"%s\"'
+ # self.text will be enclosed by quotes, and the direction
+ # modifier must be separated from the opening quote by a space.
+ # This is so that subsequent line breaking for the output file
+ # using utilities.split_string_and_preserve_doublequoted_strings()
+ # properly detects the opening quote.
+ base_string = '%s \"%s\"'
if self.markup:
base_string = '%s\markup{ ' + self.markup + ' {%s} }'
return base_string % (self.direction_mod (), self.text)
return return_string
def pre_note_ly (self, is_chord_element):
if self.style and is_chord_element:
- return "\\tweak #'style #%s" % self.style
+ return "\\tweak style #%s" % self.style
else:
return ''
def ly_expression (self):
elif self.non_standard_alterations:
alterations = [self.format_non_standard_alteration (a) for
a in self.non_standard_alterations]
- return "\\set Staff.keySignature = #`(%s)" % string.join (alterations, " ")
+ return "\\set Staff.keyAlterations = #`(%s)" % string.join (alterations, " ")
else:
return ''
if self.style == "common":
st = "\\defaultTimeSignature"
elif (self.style != "'()"):
- st = "\\once \\override Staff.TimeSignature #'style = #%s " % self.style
+ st = "\\once \\override Staff.TimeSignature.style = #%s " % self.style
elif (self.style != "'()") or is_common_signature:
st = "\\numericTimeSignature"
self.lines = lines
def ly_expression (self):
if (self.lines > 0):
- return "\\stopStaff \\override Staff.StaffSymbol #'line-count = #%s \\startStaff" % self.lines
+ return "\\stopStaff \\override Staff.StaffSymbol.line-count = #%s \\startStaff" % self.lines
else:
- return "\\stopStaff \\revert Staff.StaffSymbol #'line-count \\startStaff"
+ return "\\stopStaff \\revert Staff.StaffSymbol.line-count \\startStaff"
class TempoMark (Music):
def __init__ (self):
if self.instrument_name or self.short_instrument_name:
printer.dump ("\\consists \"Instrument_name_engraver\"")
if self.spanbar == "no":
- printer.dump ("\\override SpanBar #'transparent = ##t")
+ printer.dump ("\\hide SpanBar")
brack = {"brace": "SystemStartBrace",
- "none": "f",
+ "none": "SystemStartBar",
"line": "SystemStartSquare"}.get (self.symbol, None)
if brack:
printer.dump ("systemStartDelimiter = #'%s" % brack)
self.print_ly_context_mods (printer)
for m in self.context_modifications:
printer.dump (m)
- printer.dump ("} <<")
+ printer.dump ("}")
printer.newline ()
#print a single << after StaffGroup only when the with-block is not needed.
#This doesn't work. << is printed before and after StaffGroup!
return
def print_ly (self, printer):
- #prints two << before a StaffGroup, one after a StaffGroup and one before each \new Staff
- #printer.dump("<<")
- #printer.newline ()
self.print_chords(printer)
self.print_fretboards(printer)
if self.stafftype:
printer.dump ("\\new %s" % self.stafftype)
+ self.print_ly_overrides (printer)
+ printer.newline ()
+ if self.stafftype:
printer.dump ("<<")
printer.newline ()
- # if there is a width-block << should not be printed after StaffGroup but after the width-block
- # this seems to work. It prints \new StaffGroup \with{} <<:
-# if self.stafftype == "StaffGroup" and self.print_ly_overrides:
- #prints a new line before each new staff type, e.g. before \new StaffGroup and \new Staff...
- #printer.newline ()
-# printer.dump("\\new %s" % self.stafftype)
- #self.print_ly_overrides (printer)
- #prints a << and a new line after each new staff type.
- # printer.dump ("<<")
- # printer.newline()
- # print a << after all other staff types:
- # can't use "else:" because then we get a '\new None' staff type in LilyPond...
-# elif self.stafftype == "StaffGroup":
-# printer.dump ("\\new %s" % self.stafftype)
-# printer.dump ("<<")
-# printer.newline ()
- # << should be printed directly after StaffGroups without a with-block:
- # this doesn't work:
-# elif self.stafftype == "StaffGroup" and not self.print_ly_overrides:
-# printer.dump ("<<")
-# printer.newline ()
- # this is bullshit:
-# elif self.stafftype == "StaffGroup" and self.stafftype == "Staff":
-# printer.dump ("<<")
-# printer.newline ()
- # this prints \new Staff << for every staff in the score:
-# elif self.stafftype:
-# printer.dump ("\\new %s" % self.stafftype)
-# printer.dump ("<<")
-# printer.newline ()
- self.print_ly_overrides (printer)
- #printer.dump ("<<")
- #printer.newline ()
if self.stafftype and self.instrument_name:
printer.dump ("\\set %s.instrumentName = %s" % (self.stafftype,
escape_instrument_string (self.instrument_name)))
- #printer.newline ()
+ printer.newline ()
if self.stafftype and self.short_instrument_name:
printer.dump ("\\set %s.shortInstrumentName = %s" % (self.stafftype,
escape_instrument_string (self.short_instrument_name)))
printer.dump(
r'\set {stafftype}.midiInstrument = #"{sound}"'.format(
stafftype=self.stafftype, sound=self.sound))
+ printer.newline ()
self.print_ly_contents (printer)
printer.newline ()
-# This is a crude hack: In scores with staff groups the closing angled brackets are not printed.
-# That's why I added the following two lines. I couldn't find a proper solution. This won't work with scores several staff groups!!!
- if self.stafftype == "StaffGroup":
+ if self.stafftype:
printer.dump (">>")
- #printer.dump (">>")
- #printer.dump (">>")
- #printer.newline ()
- #printer.dump ("test") #test is printed 4 times in a staffgroup with two staves: once at the end of each staff and twice at the end of the staffgroup. That's not what we want!
- #printer.dump ("test") NameError: name 'printer' is not defined
-
-#test
-# def print_staffgroup_closing_brackets (self, printer): #test see class Staff / Score.
-# printer.dump ("test")
+ printer.newline ()
class Staff (StaffGroup):
self.substafftype = "Staff"
#printer.dump ('test')
StaffGroup.print_ly (self, printer)
- #StaffGroup.print_staffgroup_closing_brackets (self, printer) prints test after each definition of a staff
- printer.dump ('>>')
- #printer.dump ("test") #prints test after each definition of a context.
- printer.newline ()
- #StaffGroup.print_staffgroup_closing_brackets(self, printer) #prints test after each definition of a staff.
- #printer.dump ("test")# NameError: name 'printer' is not defined
- #StaffGroup.print_staffgroup_closing_brackets() #TypeError: unbound method print_staffgroup_closing_brackets() must be called with StaffGroup instance as first argument (got nothing instead)
class TabStaff (Staff):