Dear list,

I'm trying to control measure width using proportional spacing.  And
it's not working as expected.

I created a kind of "into/out of" proportional notation wrapper:

ePUT  =
#(define-music-function
 (parser location num music)
 (number? ly:music?)
#{
\set Score.proportionalNotationDuration = #(ly:make-moment 1 num)
\override Score.SpacingSpanner.uniform-stretching = ##t
#music
\set Score.proportionalNotationDuration = #(ly:make-moment 1/4)
\override Score.SpacingSpanner.uniform-stretching = ##f
#})

Based on a previous email exchange and used it around phrases I want to
have a fixed width, no matter where they are used (easily recognised).
 However, I discovered that depending on where they are located, a
different moment was needed.

I've attached a part of the score I'm working on (actually a drum
transcription), stripped down a bit.  Maybe there's an obvious problem
to more experienced eyes.

Briefly, the first 4 lines contain phrases that are used more than
once.  The very last measure on the last line (\fill1) is the only
measure not seen elsewhere.

To give an example of the problem, in one location I need:

\ePUT #14 { \chorusI }  % ie. make-moment 1/14

but in another location I need:

\ePUT #3 { \chorusI }   % ie. make-moment 1/3

for what are the same notes.  This behaviour makes no sense to me.   
Am I doing something fundamentally wrong?

Basically the only widths I want flexible are the percent repeats and
\fill1.  If there's another way, I'd appreciate suggestions.

The file as attached works with 2.19.83 (I use 2.18.2) and has the same
behaviour.  So I don't think this is a bug.  Likely a problem between
the chair and the keyboard...

Thanks,
Stef




% ====== Drum notations customized
#(define md '(
  (ridecymbal   cross    #f  4)(ridebell     xcircle  #f  4)
  (crashcymbal  cross    #f  6)(splashcymbal harmonic #f  6)
  (pedalhihat   cross    #f -4)(hihat        cross    #f  5)
  (snare        default  #f  1)(sidestick    cross    #f  1)
  (highfloortom     default  #f -1)(lowtom       default  #f 2)
  (hightom      default  #f  3)(bassdrum     default  #f -3)
  (openhihat    cross "open" 5)(closedhihat  cross "stopped" 5)
      (halfopenhihat xcircle #f 5)
      (closedhihat cross "stopped" 5)
))


%%%%%%%%%%%%%%%%%%%%%%%% Functions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

#(define ((bars-per-line-engraver bar-list) context)
  (let* ((working-copy bar-list)
         (total (1+ (car working-copy))))
    `((acknowledgers
       (paper-column-interface
        . ,(lambda (engraver grob source-engraver)
             (let ((internal-bar (ly:context-property context 'internalBarNumber)))
               (if (and (pair? working-copy)
                        (= (remainder internal-bar total) 0)
                        (eq? #t (ly:grob-property grob 'non-musical)))
                   (begin
                     (set! (ly:grob-property grob 'line-break-permission) 'force)
                     (if (null? (cdr working-copy))
                         (set! working-copy bar-list)
                         (begin
                           (set! working-copy (cdr working-copy))))
                           (set! total (+ total (car working-copy))))))))))))

ePUT  =
#(define-music-function (parser location num music) (number? ly:music?)
   #{
	\set Score.proportionalNotationDuration = #(ly:make-moment 1 num)
	\override Score.SpacingSpanner.uniform-stretching = ##t
%	\override Score.SpacingSpanner.strict-note-spacing = ##t
	#music
	\set Score.proportionalNotationDuration = #(ly:make-moment 1/4)
	\override Score.SpacingSpanner.uniform-stretching = ##f
%	\override Score.SpacingSpanner.strict-note-spacing = ##f
   #})

preVerse = \drummode {
	<<
	{ cymr8 cymr8 \tuplet3/2{hh16 hh hh} hh8 \tuplet3/2{tomh16 tomh tomh} \tuplet3/2{tomh16 tomh toml} \tuplet3/2{tomh16 tomfh tomh} tomfh8 }
	\\
	{ bd8 bd8 s4 s2 }
	>>
}

verse = \drummode {
	<<
	{\repeat unfold 8 tomfh8 }
	\\
	{\repeat unfold 4 { bd4 }}
	>>
}

preChorus = \drummode {
	<<
	{ cymc1 | s1 }
	\\
	\repeat unfold 2 { bd8. bd16 bd4 bd8. bd16 bd4 }
	>>
}

chorusI = \drummode {
	<<
	{ s4 sn4 s4 sn4 | s4 sn4 s4 r4 }
	\\
	{\repeat unfold 2 { bd4 s4 bd4 s4 } }
	>>
}

fillI = \drummode {
	<<
	{ cymr8 cymr8 \tuplet3/2{hh16 hh hh} hh8 tomh16 toml8 tomh16 tomfh16 tomfh16 toml16 toml16 }
	\\
	{ bd8 bd8 s4 s2 }
	>>
}

theMusic = \drummode {
	% CountPercentRepeats must be set or an error is thrown
	\set countPercentRepeats = ##t
	% But we can also hide the repeat count (workaround)
	\hide PercentRepeatCounter
	\time 4/4
	\tempo 4 = 84
% lines 1 & 2
	\repeat volta 2 {
		\repeat percent 4 { \ePUT #4 { \preVerse } }
		\repeat percent 6 { \ePUT #30 { \verse } }
		\ePUT #16 { \preChorus }
	}
% line 3
	\ePUT #14 { \chorusI } \repeat percent 4 { \ePUT #12 { \preVerse } }
% line 4
	\repeat percent 6 { \ePUT #30 { \verse } } \ePUT #16 { \preChorus }
% line 5
	\ePUT #3 { \chorusI }  \ePUT #4 { \preVerse } \fillI
}

\score {
	\new DrumStaff {
		\set Staff.instrumentName = #"drums"
		\set DrumStaff.drumStyleTable = #(alist->hash-table md) 
		<<
			\new DrumVoice {
				\theMusic
			}
		>>
	}
	\layout {
		\context {
			\DrumStaff
			\remove "Instrument_name_engraver"

			% horizontal beams
			\override Beam.damping = #+inf.0
			\override Stem.no-stem-extend = ##t
		}
		\context {
			\Score
%			\remove "Bar_number_engraver"
			\numericTimeSignature
			
			\override NoteColumn #'ignore-collision = ##t
			\mergeDifferentlyHeadedOn \mergeDifferentlyDottedOn

			\override NonMusicalPaperColumn.line-break-permission = ##f
			\consists #(bars-per-line-engraver '(4 8 6 8 4 ))
		}
		\context Voice = "one" {
			\override NoteHead.font-size = #2

		}
		\context Voice = "two" {
			\override NoteHead.font-size = #0.5
		}


	}
}

% ===== Page customizations
\paper{
	#(set-paper-size "letter")
  	indent=#0
  	left-margin =10\mm
  	right-margin = 10\mm
	top-margin = 10\mm
	bottom-margin  = 10\mm
%	line-width=#200

	ragged-right = ##f
	ragged-bottom = ##f

	check-consistency = ##t
}

\version "2.18.2"

Attachment: horizontal-spacing-7.pdf
Description: Adobe PDF document

_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to