From 493e670b2be12e94f6ebf57a709981bf7f452b25 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Thu, 5 Feb 2004 14:34:06 +0000 Subject: [PATCH] * lily/parser.yy (chord_body_element): add DRUM_PITCH to chords (i.e. < > ) * ly/performer-init.ly: add DrumStaff * ly/engraver-init.ly: remove Lyrics context. (TabVoice): add noteheads engraver * ly/engraver-init.ly: remove Thread * scripts/convert-ly.py (conv): \harmonic rule * ly/engraver-init.ly: add DrumStaff and DrumVoice contexts --- ChangeLog | 5 + Documentation/topdocs/NEWS.texi | 2 + .../J.S.Bach/baerenreiter-sarabande.ly | 4 +- input/template/jazz-combo.ly | 75 ++++---- lily/parser.yy | 17 +- ly/declarations-init.ly | 1 - ly/engraver-init.ly | 3 - ly/performer-init.ly | 168 ++++++++++-------- scripts/convert-ly.py | 5 +- 9 files changed, 159 insertions(+), 121 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1bc89e70aa..0cc0b84a6c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2004-02-05 Han-Wen Nienhuys + * lily/parser.yy (chord_body_element): add DRUM_PITCH to chords + (i.e. < > ) + + * ly/performer-init.ly: add DrumStaff + * lily/axis-group-engraver.cc (acknowledge_grob): also take lyric-interface; this prevents lines with only extender lines from being junked. diff --git a/Documentation/topdocs/NEWS.texi b/Documentation/topdocs/NEWS.texi index 0961eb2f51..17fd15d29f 100644 --- a/Documentation/topdocs/NEWS.texi +++ b/Documentation/topdocs/NEWS.texi @@ -17,6 +17,8 @@ Version 2.1.13 @end ignore @itemize @bullet +@item The @code{Lyrics} context has been removed. Lyrics should only +be constructed in @code{LyricsVoice}. @item The @code{Thread} context has been removed. Note heads and rests are now constructed at @code{Voice} level. diff --git a/input/mutopia/J.S.Bach/baerenreiter-sarabande.ly b/input/mutopia/J.S.Bach/baerenreiter-sarabande.ly index e921a6c5b3..658588d7ea 100644 --- a/input/mutopia/J.S.Bach/baerenreiter-sarabande.ly +++ b/input/mutopia/J.S.Bach/baerenreiter-sarabande.ly @@ -1,4 +1,4 @@ -\version "2.1.7" +\version "2.1.19" % #(ly:set-point-and-click 'line-column) @@ -121,7 +121,7 @@ sarabandeA = \context Voice \notes \relative c { d'[ cis] | %% d4 d,,2 | d4 - \property Thread.NoteHead + \property Voice.NoteHead \override #'after-line-breaking-callback = #(lambda (smob) (assert-system-count smob 6)) d,,2 | diff --git a/input/template/jazz-combo.ly b/input/template/jazz-combo.ly index fa59fe0a1a..65ecdd424d 100644 --- a/input/template/jazz-combo.ly +++ b/input/template/jazz-combo.ly @@ -1,4 +1,4 @@ -\version "2.1.13" +\version "2.1.19" \header { title = "Song" subtitle = "(tune)" @@ -15,11 +15,13 @@ %%%%%%%%%%%% Some macros %%%%%%%%%%%%%%%%%%% sl = { - \property Voice.NoteHead \override #'style = #'slash - \property Voice.Stem \override #'length = #0 } + \property Voice.NoteHead \override #'style = #'slash + \property Voice.Stem \override #'transparent = ##t +} nsl = { - \property Voice.NoteHead \revert #'style - \property Voice.Stem \revert #'length } + \property Voice.NoteHead \revert #'style + \property Voice.Stem \revert #'transparent +} cr = \property Voice.NoteHead \override #'style = #'cross ncr = \property Voice.NoteHead \revert #'style @@ -27,29 +29,30 @@ ncr = \property Voice.NoteHead \revert #'style jzchords = { } + %%%%%%%%%%%% Keys'n'thangs %%%%%%%%%%%%%%%%% global = \notes { - \time 4/4 + \time 4/4 } -Key = \notes \key c \major +Key = \notes { \key c \major } % ############ Horns ############ % ------ Trumpet ------ trpt = \notes \transpose c d \relative c'' { - \Key - c1 c c + \Key + c1 c c } trpharmony = \chords \transpose c' d { \jzchords } trumpet = { - \global - \property Staff.instrument = #"Trumpet" - \clef treble - \context Staff << - \trpt - >> + \global + \property Staff.instrument = #"Trumpet" + \clef treble + \context Staff << + \trpt + >> } % ------ Alto Saxophone ------ @@ -178,31 +181,33 @@ bass = \notes \relative c { } bass = { - \global - \property Staff.instrument = #"Bass" - \clef bass - \context Staff << - \bass - >> + \global + \property Staff.instrument = #"Bass" + \clef bass + \context Staff << + \bass + >> } -% ------ Drums ------ -\include "drumpitch-init.ly" -up = \notes { - hh4 <> hh4 <> hh4 <> hh4 <> - hh4 <> hh4 <> + % ------ Drums ------ + +up = \drums { + hh4 4 hh hh 4 + hh4 4 + hh4 4 + hh4 4 } -down = \notes { - bd4 s bd s bd s bd s bd s bd s + +down = \drums { + bd4 s bd s bd s bd s bd s bd s } -drums = \context Staff = drums { +drumContents = { \global - \property Staff.instrument = #"Drums" - \clef percussion << - \context Voice = first { \voiceOne \up } - \context Voice = second { \voiceTwo \down } + \property DrumStaff.instrument = #"Drums" + \new DrumVoice { \voiceOne \up } + \new DrumVoice { \voiceTwo \down } >> } @@ -229,10 +234,9 @@ drums = \context Staff = drums { \context Staff = bass \bass - \apply #(drums->paper 'drums) \drums + \new DrumStaff { \drumContents } >> >> - \midi { \tempo 4 = 75 } \paper { linewidth = 15.0 \cm \translator { \RemoveEmptyStaffContext } @@ -243,5 +247,6 @@ drums = \context Staff = drums { skipBars = ##t } } + \midi { \tempo 4 = 75 } } diff --git a/lily/parser.yy b/lily/parser.yy index de733ff58c..5debced12e 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -1288,9 +1288,22 @@ chord_body_element: if ($2 % 2 || $3 % 2) n->set_mus_property ("force-accidental", SCM_BOOL_T); - SCM arts = scm_reverse_x ($4, SCM_EOL); - n->set_mus_property ("articulations", arts); + if (gh_pair_p ($4)) { + SCM arts = scm_reverse_x ($4, SCM_EOL); + n->set_mus_property ("articulations", arts); + } + $$ = n; + } + | DRUM_PITCH post_events { + Music *n = MY_MAKE_MUSIC("NoteEvent"); + n->set_mus_property ("duration" ,$2); + n->set_mus_property ("drum-type" , $1); + n->set_spot (THIS->here_input()); + if (gh_pair_p ($2)) { + SCM arts = scm_reverse_x ($2, SCM_EOL); + n->set_mus_property ("articulations", arts); + } $$ = n; } ; diff --git a/ly/declarations-init.ly b/ly/declarations-init.ly index 344e00f0b1..a9247573c0 100644 --- a/ly/declarations-init.ly +++ b/ly/declarations-init.ly @@ -114,7 +114,6 @@ paperTwentysix = \paper { partCombineListener = \paper { \translator { \VoiceContext - \denies Thread \consists Note_heads_engraver \consists Rest_engraver \type "Recording_group_engraver" diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly index 4b9421e647..5663553a91 100644 --- a/ly/engraver-init.ly +++ b/ly/engraver-init.ly @@ -387,9 +387,6 @@ RemoveEmptyStaffContext= \translator { \StaffContext \remove "Axis_group_engraver" \consistsend "Hara_kiri_engraver" - \accepts "Voice" - - % hara kiri & auto knee don't work together. Beam \override #'auto-knee-gap = #'() } diff --git a/ly/performer-init.ly b/ly/performer-init.ly index b3e27bb34b..244f0eb5e4 100644 --- a/ly/performer-init.ly +++ b/ly/performer-init.ly @@ -1,129 +1,143 @@ \version "2.1.19" -% -% setup for Request->Element conversion. Guru-only -% + % + % setup for Request->Element conversion. Guru-only + % \translator { - \type "Staff_performer" - \name Staff - \accepts Voice + \type "Staff_performer" + \name Staff + \accepts Voice - \consists "Key_performer" - \consists "Tempo_performer" - \consists "Time_signature_performer" + \consists "Key_performer" + \consists "Tempo_performer" + \consists "Time_signature_performer" } - \translator { - \type "Performer_group_performer" - \name Voice - \consists "Dynamic_performer" - \consists "Span_dynamic_performer" - \consists "Tie_performer" - \consists "Piano_pedal_performer" - \accepts "Voice" + \StaffContext + \name DrumStaff + \accepts DrumVoice } \translator { - \type "Performer_group_performer" - \name Voice - \consists "Note_performer" + \type "Performer_group_performer" + \name Voice + \consists "Dynamic_performer" + \consists "Span_dynamic_performer" + \consists "Tie_performer" + \consists "Piano_pedal_performer" } \translator { - \type "Performer_group_performer" - \name FiguredBass - \consists "Swallow_performer" + \VoiceContext + \name DrumVoice } \translator { - \type "Performer_group_performer" - \name GrandStaff - \accepts RhythmicStaff - \accepts Staff + \type "Performer_group_performer" + \name Voice + \consists "Note_performer" } \translator { - \type "Performer_group_performer" - \name "PianoStaff" - \accepts Staff + \type "Performer_group_performer" + \name FiguredBass + \consists "Swallow_performer" } \translator { - \type "Performer_group_performer" - \name "TabVoice" - \consists "Swallow_performer" + \type "Performer_group_performer" + \name GrandStaff + \accepts RhythmicStaff + \accepts Staff } \translator { - \type "Performer_group_performer" - \name "Devnull" - \consists "Swallow_performer" + \type "Performer_group_performer" + \name "PianoStaff" + \accepts Staff + \accepts DrumStaff } + \translator { - \type "Performer_group_performer" - \name "TabStaff" - \accepts "TabVoice" + \type "Performer_group_performer" + \name "TabVoice" + \consists "Swallow_performer" } \translator { - \type "Score_performer" - - \name Score - \alias Timing - instrument = #"bright acoustic" - \accepts Staff - \accepts GrandStaff - \accepts PianoStaff - \accepts TabStaff - \accepts StaffGroup - \accepts Devnull - \accepts ChoirStaff - \accepts RhythmicStaff - \accepts ChordNames - \accepts FiguredBass + \type "Performer_group_performer" + \name "Devnull" + \consists "Swallow_performer" +} +\translator { + \type "Performer_group_performer" + \name "TabStaff" + \accepts "TabVoice" +} - \alias "Timing" - \consists "Timing_translator" - \consists "Swallow_performer" - - dynamicAbsoluteVolumeFunction = #default-dynamic-absolute-volume - instrumentEqualizer = #default-instrument-equalizer +\translator { + \type "Score_performer" + + \name Score + \alias Timing + instrument = #"bright acoustic" + \accepts Staff + \accepts DrumStaff + \accepts GrandStaff + \accepts PianoStaff + \accepts TabStaff + \accepts Staff + \accepts StaffGroup + \accepts Devnull + \accepts ChoirStaff + \accepts RhythmicStaff + \accepts ChordNames + \accepts FiguredBass + + \alias "Timing" + \consists "Timing_translator" + \consists "Swallow_performer" + + dynamicAbsoluteVolumeFunction = #default-dynamic-absolute-volume + instrumentEqualizer = #default-instrument-equalizer } \translator { - \type "Staff_performer" % Performer_group_performer ? - \consists "Lyric_performer" - \name LyricsVoice - \consists "Time_signature_performer" - \consists "Tempo_performer" + \type "Staff_performer" % Performer_group_performer ? + \consists "Lyric_performer" + \name LyricsVoice + \consists "Time_signature_performer" + \consists "Tempo_performer" } \translator{ - \type "Performer_group_performer" - \name ChoirStaff - \accepts Staff + \type "Performer_group_performer" + \name ChoirStaff + \accepts Staff + \accepts DrumStaff } \translator { - \type "Staff_performer" - \accepts ChordNameVoice - \name ChordNames + \type "Staff_performer" + \accepts ChordNameVoice + \name ChordNames } \translator { - \type "Performer_group_performer" - \consists "Note_performer" - \name ChordNameVoice + \type "Performer_group_performer" + \consists "Note_performer" + \name ChordNameVoice } \translator { - \type "Performer_group_performer" + \type "Performer_group_performer" - \name StaffGroup - \accepts Staff + \name StaffGroup + \accepts Staff + \accepts DrumStaff } \translator { \StaffContext \name RhythmicStaff } diff --git a/scripts/convert-ly.py b/scripts/convert-ly.py index 318198c5fe..2754d6cb89 100644 --- a/scripts/convert-ly.py +++ b/scripts/convert-ly.py @@ -1776,9 +1776,12 @@ conversions.append (((2,1,18), conv, """\\newpartcombine -> \\partcombine, def conv (str): - str = re.sub (r'\\include "drumpitch-init.ly','', str) + str = re.sub (r'\\include "drumpitch-init.ly"','', str) str = re.sub (r'\\pitchnames ','pitchnames = ', str) str = re.sub (r'\\chordmodifiers ','chordmodifiers = ', str) + str = re.sub (r'\bdrums\b\s*=','drumContents = ', str) + str = re.sub (r'\\drums\b','\\drumContents ', str) + if re.search ('drums->paper', str): sys.stderr.write ("\nDrum notation found. Check file manually!") -- 2.39.2