#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
{
/**
A pause.
+
+ See also Rhythmic_head, Staff_symbol_referencer.
- Properties
+ Read-only properties:
style -- string specifying glyph style
*/
/*
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
{
#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:
+/*
+ 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.)
+
+ */
\consists "Collision_engraver";
\consists "Rest_collision_engraver";
\consists "Local_key_engraver";
-
\consists "Piano_pedal_engraver";
+ \consists "Arpeggio_engraver";
\consistsend "Axis_group_engraver";
\type "Engraver_group_engraver";
\name GrandStaff;
\consists "Span_bar_engraver";
+ \consists "Span_arpeggio_engraver";
\consists "System_start_delimiter_engraver";
systemStartDelimiterGlyph = #'brace
\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";
\consists "Lyric_phrasing_engraver";
\consists "Bar_number_engraver";
+ \consists "Span_arpeggio_engraver";
\accepts "Staff";
% 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)
(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")
(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)
(":|" . (":|" . nil))
("||" . ("||" . nil))
(".|." . (".|." . nil))
+ ("empty" . ("nil" . nil))
("brace" . (nil . "brace"))
("bracket" . (nil . "bracket"))
)
#
# (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
# 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
lyric_idx = -1
part_names = 0
default_len = 8
+length_specified = 0
global_key = [0] * 7 # UGH
names = ["One", "Two", "Three"]
DIGITS='0123456789'
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 ()
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}")
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)
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
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:
'::' : '::',
'|1' : '|',
'|2' : '|',
-':|2' : ':|'
+':|2' : ':|',
+'|' : '|'
}
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]