Re: absolute pitch entry: accept an offset octave (issue 235010043 by k-ohara5a5a oco.net)
Wols Lists youngman.org.uk> writes: > On 21/05/15 07:36, k-ohara5a5a oco.net wrote: > > I'm proposing to push a \fixed c' {} that always takes a reference > > pitch, as in the current patch. > So the behaviour is different from \relative, which doesn't have to > have a reference pitch. Before version 2.18, \relative{} defaulted to relative c'{} but that was deprecated with version 2.12. Since version 2.18 \relative{} defaults to \relative f{}, which acts the same as taking the starting octave from the first pitch \relative {c''4 c g' g} == \relative c'' {c4 c g' g} I have seen two different suggestions for what default behavior to use if the reference pitch after \fixed is omitted. Neither default seems obvious to me, so I'm proposing we use \fixed with an explicit pitch until it becomes clear that one usage is natural and useful enough to be default. 1) Something like the old \relative {} -> relative c' {} > If \fixed takes an optional (defaults to c') reference pitch then the > underlying code will be the same. Earlier versions of the proposed patch did this, but defaulting to c not c' 2) Something like the new \relative {c'' ...} -> relative c'' {c ...} googlemail.com> writes: > I'd prefer the syntax and options to parallel those of > \relative. That is, an optional prefix pitch to indicate > the starting octave, and taking the starting octave from > the first contained note if the prefix is omitted. We could implement this, but unlike \relative where each octave mark increments the octave of the previous pitch, there is no simple way to start the machinery of \fixed so that the octave shift is determined by the first pitch it acts upon. We need code to explicitly find the first pitch and extract its octave. -- absolute = #(define-music-function (parser location pitch music) ((ly:pitch?) ly:music?) (_i "Shift the octave of each pitch in @code{music} according to the ocatve marks @code{pitch}. If @code{pitch} is ommitted, use the octave marks from the first pitch found in @code{music} to shift the octave of all the pitches in @code{music} except the first. The result is absolute music, wrapped as @samp{RelativeOctaveMusic} to hide it from surrounding @code{\\relative} and @code{\\absolute} commands.") (define (extract-octave-from-first-pitch m) (if (eq? (ly:music-property m 'name) 'RelativeOctaveMusic) #f (or (let ((p (ly:music-property m 'pitch))) (and (ly:pitch? p) (let ((octave-marks (1+ (ly:pitch-octave p ;;Reverse-shift the first pitch, ;; so later we can shift back with all the others (ly:music-transpose m (ly:make-pitch (- octave-marks) 0 0)) octave-marks))) (let ((e (ly:music-property m 'element))) (and (ly:music? e) (extract-octave-from-first-pitch e))) (let loop ((elts (ly:music-property m 'elements))) (and (pair? elts) (or (extract-octave-from-first-pitch (car elts)) (loop (cdr elts (let ((octave-marks (or (and pitch (1+ (ly:pitch-octave pitch))) (extract-octave-from-first-pitch music) 0))) (display octave-marks) (newline) (cond ((not (= 0 octave-marks)) (ly:music-transpose music (ly:make-pitch octave-marks 0 0)) ;;In order to leave unchanged the notes in any enclosed ;; \absolute or \fixed or \relative, make a cancelling shift (map (lambda (m) (ly:music-transpose m (ly:make-pitch (- octave-marks) 0 0))) (extract-named-music music 'RelativeOctaveMusic) (make-music 'RelativeOctaveMusic 'element music)) ___ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: absolute pitch entry: accept an offset octave (issue 235010043 by k-ohara5a5a oco.net)
On 23/05/15 23:39, Keith OHara wrote: > googlemail.com> writes: >> > I'd prefer the syntax and options to parallel those of >> > \relative. That is, an optional prefix pitch to indicate >> > the starting octave, and taking the starting octave from >> > the first contained note if the prefix is omitted. > We could implement this, but unlike \relative where each octave mark > increments the octave of the previous pitch, there is no simple way to > start the machinery of \fixed so that the octave shift is determined by > the first pitch it acts upon. > We need code to explicitly find the first pitch and extract its octave. Is this a good idea though? If I want "\fixed c {}" but my first note just happens to be d' then it's going to be a pain. It's also going to be very odd in that the octave markings for the first note are going to be different from the octave markings for all the rest. I don't know what fraction of parts start on a relatively high or low note compared to the bulk of the part, but taking the octave from the first note won't work in those circumstances. If that's a fair few parts (I'm minded of a Benjamin Britten part, the trombone's first note is also almost off the top of its register! :-) then I'd say that code isn't worth the trouble - it really depends on whether the majority of parts start in the middle of an instrument's register. I'd be a lot happier assuming that if no note is given, then you assume c so it's the same as if you were using neither \fixed / \absolute, nor \relative. Cheers, Wol ___ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: absolute pitch entry: accept an offset octave (issue 235010043 by k-ohara5a5a oco.net)
Wols Lists youngman.org.uk> writes: > On 23/05/15 23:39, Keith OHara wrote: > > googlemail.com> writes: > >> > I'd prefer the syntax and options to parallel those of > >> > \relative. That is, an optional prefix pitch to indicate > >> > the starting octave, and taking the starting octave from > >> > the first contained note if the prefix is omitted. > > > We could implement this, but ... > > Is this a good idea though? I think not, and everyone seems at least content to do without this behavior, at least for now. (I wasn't sure until now which behavior you were favoring, in the case of an omitted reference pitch.) > If I want "\fixed c {}" but my first note > just happens to be d' then it's going to be a pain. Well, the pain is limited to that involved in typing the explicit 'c', or the extra few letters in \absolute We will have the following choices, out of which maybe will emerge a second pattern as generally useful as many people find \relative{} : \absolute {\key g\major \clef alto \time 3/4 | d'8 d' b4 d' | b g a8 b8 | c'4 a d' | b g4. d'8 | d'4 b d' | b g a8 b8 | c'4 a d' | b g2 } \fixed c {\key g\major \clef alto \time 3/4 | d'8 d' b4 d' | b g a8 b8 | c'4 a d' | b g4. d'8 | d'4 b d' | b g a8 b8 | c'4 a d' | b g2 } \relative {\key g\major \clef alto \time 3/4 | d'8 d b4 d | b g a8 b8 | c4 a d | b g4. d'8 | d4 b d | b g a8 b8 | c4 a d | b g2 } \relative d' {\key g\major \clef alto \time 3/4 | d8 d b4 d | b g a8 b8 | c4 a d | b g4. d'8 | d4 b d | b g a8 b8 | c4 a d | b g2 } ___ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel