From 606ada8888ec883847ea2a58452f651f7eda5aea Mon Sep 17 00:00:00 2001 From: fred Date: Tue, 26 Mar 2002 23:57:06 +0000 Subject: [PATCH] lilypond-1.3.95 --- lily/include/note-head.hh | 11 +++++----- lily/include/rest.hh | 4 +++- lily/include/rhythmic-head.hh | 8 +++++-- lily/include/spacing-spanner.hh | 23 ++++++++++++++++++++ lily/spacing-spanner.cc | 38 +++++++++++++++++++++++++++++++++ ly/engraver.ly | 30 +++++++++++++++++++------- scm/basic-properties.scm | 1 + scripts/abc2ly.py | 26 ++++++++++++++-------- 8 files changed, 115 insertions(+), 26 deletions(-) diff --git a/lily/include/note-head.hh b/lily/include/note-head.hh index 8974b9828d..6703c443bb 100644 --- a/lily/include/note-head.hh +++ b/lily/include/note-head.hh @@ -10,15 +10,14 @@ #include "lily-guile.hh" #include "molecule.hh" -/** ball at the end of the stem. Takes care of: +/** ball at the end of the stem. Also takes care of ledger lines. - * help lines - - Properties + NoteHead is a kind of RhythmicHead, see there. + Read-only: + style -- symbol that sets note head style - - */ +*/ class Note_head { diff --git a/lily/include/rest.hh b/lily/include/rest.hh index 204c19f407..051bdaf989 100644 --- a/lily/include/rest.hh +++ b/lily/include/rest.hh @@ -14,8 +14,10 @@ /** A pause. + + See also Rhythmic_head, Staff_symbol_referencer. - Properties + Read-only properties: style -- string specifying glyph style */ diff --git a/lily/include/rhythmic-head.hh b/lily/include/rhythmic-head.hh index 855f84b7f7..50b1b87187 100644 --- a/lily/include/rhythmic-head.hh +++ b/lily/include/rhythmic-head.hh @@ -16,10 +16,14 @@ /* Properties - duration-log -- 2-log of the notehead duration - dot -- reference to Dots object. + stem -- pointer to Stem object + + Read-only + + duration-log -- 2-log of the notehead duration + */ class Rhythmic_head { diff --git a/lily/include/spacing-spanner.hh b/lily/include/spacing-spanner.hh index 7f678043ee..f0f81dde76 100644 --- a/lily/include/spacing-spanner.hh +++ b/lily/include/spacing-spanner.hh @@ -12,6 +12,29 @@ #include "spanner.hh" +/** + Read-only properties + + maximum-duration-for-spacing -- rational: space as if a duration of + this type is available in this measure. + + + + Read properties from paper-column + + dir-list -- list of stem directions + + shortest-playing-duration -- duration of the shortest playing in that column. + + shortest-starter-duration -- duration of the shortest notes that starts + exactly in that column. + + contains-grace -- boolean. Used to widen entries for grace notes. + + extra-space -- pair of distances + + stretch-distance -- pair of distances + */ class Spacing_spanner { public: diff --git a/lily/spacing-spanner.cc b/lily/spacing-spanner.cc index 5483955386..43ef9b974a 100644 --- a/lily/spacing-spanner.cc +++ b/lily/spacing-spanner.cc @@ -340,3 +340,41 @@ Spacing_spanner::set_springs (SCM smob) +/* + maximum-duration-for-spacing +From: bf250@freenet.carleton.ca (John Sankey) +To: gnu-music-discuss@gnu.org +Subject: note spacing suggestion +Date: Mon, 10 Jul 2000 11:28:03 -0400 (EDT) + +Currently, Lily spaces notes by starting with a basic distance, +arithmetic_multiplier, which it applies to the minimum duration note +of the bar. Then she adds a logarithmic increment, scaled from +arithmetic_basicspace, for longer notes. (Then, columns are aligned +and justified.) Fundamentally, this matches visual spacing to musical +weight and works well. + +A lot of the time in music, I see a section basically in melodic +notes that occasionally has a rapid ornamental run (scale). So, there +will be a section in 1/4 notes, then a brief passage in 1/32nds, then +a return to long notes. Currently, Lily gives the same horizontal +space to the 1/32nd notes in their bar (even if set in small size as +is commonly done for cadenzii) as she gives to 1/4 notes in bars +where 1/4 note is the minimum duration. The resulting visual weight +does not match the musical weight over the page. + +Looking at the music I am typesetting, I feel that Lily's spacing +could be significantly improved if, with no change in the basic +method used, arithmetic_multiplier could be applied referred to the +same duration throughout a piece. Of course, the current method +should be retained for those who have already set music in it, so I +suggest a property called something like arithmetic_base=16 to fix +1/16 duration as the reference for arithmetic_multiplier; the default +would be a dynamic base is it is now. + +Does anyone else feel that this would be a useful improvement for +their music? (Of course, if arithmetic_multiplier became a regular +property, this could be used to achieve a similar result by +tweaking.) + + */ diff --git a/ly/engraver.ly b/ly/engraver.ly index b5f51c2f0b..53c4a8aab1 100644 --- a/ly/engraver.ly +++ b/ly/engraver.ly @@ -31,8 +31,8 @@ StaffContext=\translator { \consists "Collision_engraver"; \consists "Rest_collision_engraver"; \consists "Local_key_engraver"; - \consists "Piano_pedal_engraver"; + \consists "Arpeggio_engraver"; \consistsend "Axis_group_engraver"; @@ -191,6 +191,7 @@ GrandStaffContext=\translator{ \type "Engraver_group_engraver"; \name GrandStaff; \consists "Span_bar_engraver"; + \consists "Span_arpeggio_engraver"; \consists "System_start_delimiter_engraver"; systemStartDelimiterGlyph = #'brace @@ -199,24 +200,27 @@ GrandStaffContext=\translator{ \accepts "Staff"; } -PianoStaffContext = \translator{\GrandStaffContext - alignmentReference = \center; +PianoStaffContext = \translator{ + \GrandStaffContext + \name "PianoStaff"; \consists "Vertical_align_engraver"; + alignmentReference = \center; VerticalAlignment \push #'threshold = #'(12 . 12) % \consistsend "Axis_group_engraver"; - \name "PianoStaff"; } StaffGroupContext= \translator { \type "Engraver_group_engraver"; + \name StaffGroup; + \consists "Span_bar_engraver"; + \consists "Span_arpeggio_engraver"; \consists "Output_property_engraver"; + systemStartDelimiterGlyph = #'bracket \consists "System_start_delimiter_engraver"; - systemStartDelimiterGlyph = #'bracket - \name StaffGroup; \accepts "Staff"; \accepts "RhythmicStaff"; \accepts "GrandStaff"; @@ -337,6 +341,7 @@ ScoreContext = \translator { \consists "Lyric_phrasing_engraver"; \consists "Bar_number_engraver"; + \consists "Span_arpeggio_engraver"; \accepts "Staff"; @@ -433,6 +438,11 @@ ScoreContext = \translator { % distances are given in stafflinethickness (thicknesses) and % staffspace (distances) % + Arpeggio = #`( + (interfaces . (arpeggio-interface)) + (molecule-callback . ,Arpeggio::brew_molecule) + (name . "arpeggio") + ) BarLine = #`( (interfaces . (bar-interface staff-bar-interface)) (break-align-symbol . Staff_bar) @@ -541,7 +551,7 @@ ScoreContext = \translator { (interfaces . (dot-interface)) (molecule-callback . ,Dots::brew_molecule) (dot-count . 1) - (position . 0.0) + (staff-position . 0.0) (Y-offset-callbacks . (,Dots::quantised_position_callback ,Staff_symbol_referencer::callback)) (name . "Dots") @@ -754,7 +764,11 @@ ScoreContext = \translator { (maximum-duration-for-spacing . ,(make-moment 1 8)) (name . "SpacingSpanner") ) - + SpanArpeggio = #`( + (interfaces . (span-arpeggio-interface)) + (molecule-callback . ,Span_arpeggio::brew_molecule) + (name . "SpanArpeggio") + ) SpanBar = #`( (interfaces . (bar-interface span-bar-interface)) (break-align-symbol . Staff_bar) diff --git a/scm/basic-properties.scm b/scm/basic-properties.scm index d07db3311e..37fe4c1944 100644 --- a/scm/basic-properties.scm +++ b/scm/basic-properties.scm @@ -180,6 +180,7 @@ (":|" . (":|" . nil)) ("||" . ("||" . nil)) (".|." . (".|." . nil)) + ("empty" . ("nil" . nil)) ("brace" . (nil . "brace")) ("bracket" . (nil . "bracket")) ) diff --git a/scripts/abc2ly.py b/scripts/abc2ly.py index cc0d03c07e..dc08ba9395 100644 --- a/scripts/abc2ly.py +++ b/scripts/abc2ly.py @@ -6,7 +6,7 @@ # # (not finished.) # ABC standard v1.6: http://www.gre.ac.uk/~c.walshaw/abc2mtex/abc.txt -# +# # Enhancements (Roy R. Rankin) # # Header section moved to top of lilypond file @@ -25,13 +25,16 @@ # Chord strings([-^]"string") can contain a '#' # Header fields enclosed by [] in notes string processed # W: words output after tune as abc2ps does it (they failed before) + +# Enhancements (Laura Conrad) +# +# Beaming now preserved between ABC and lilypond # # Limitations # # Multiple tunes in single file not supported # Blank T: header lines should write score and open a new score # Not all header fields supported -# Beaming not preserved between ABC and lilypond # ABC line breaks are ignored # Block comments generate error and are ignored # Postscript commands are ignored @@ -71,6 +74,7 @@ current_lyric_idx = -1 lyric_idx = -1 part_names = 0 default_len = 8 +length_specified = 0 global_key = [0] * 7 # UGH names = ["One", "Two", "Three"] DIGITS='0123456789' @@ -147,6 +151,10 @@ def dump_lyrics (outf): outf.write ("\n") outf.write(" >\n \\paper{}\n}\n") +def dump_default_bar (outf): + outf.write ("\n\\property Score.defaultBarType=\"empty\"\n") + + def dump_slyrics (outf): ks = voice_idx_dict.keys() ks.sort () @@ -161,6 +169,7 @@ def dump_voices (outf): ks.sort () for k in ks: outf.write ("\nvoice%s = \\notes {" % k) + dump_default_bar(outf) outf.write ("\n" + voices [voice_idx_dict[k]]) outf.write ("\n}") @@ -201,6 +210,7 @@ def set_default_length (s): m = re.search ('1/([0-9]+)', s) if m: __main__.default_len = string.atoi ( m.group (1)) + length_specified = 1 def set_default_len_from_time_sig (s): m = re.search ('([0-9]+)/([0-9]+)', s) @@ -502,8 +512,8 @@ def try_parse_header_line (ln, state): state.common_time = 1 voices_append ("\\property Staff.timeSignatureStyle=\"C\"\n") a = '2/2' -# global_voice_stuff.append ('\\time %s;' % a) - set_default_len_from_time_sig (a) + if not length_specified: + set_default_len_from_time_sig (a) voices_append ('\\time %s;' % a) state.next_bar = '' if g == 'K': # KEY @@ -595,12 +605,9 @@ def parse_num (str): def duration_to_mudela_duration (multiply_tup, defaultlen, dots): base = 1 - # (num / den) / defaultlen < 1/base while base * multiply_tup[0] < multiply_tup[1]: base = base * 2 - - return '%d%s' % ( base, '.'* dots) class Parser_state: @@ -889,7 +896,8 @@ bar_dict = { '::' : '::', '|1' : '|', '|2' : '|', -':|2' : ':|' +':|2' : ':|', +'|' : '|' } @@ -899,7 +907,7 @@ def try_parse_bar (str,state): bs = None # first try the longer one - for trylen in [3,2]: + for trylen in [3,2,1]: if str[:trylen] and bar_dict.has_key (str[:trylen]): s = str[:trylen] bs = "\\bar \"%s\";" % bar_dict[s] -- 2.39.5