[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: tablature.ly - please test and comment
From: |
Neil Puttock |
Subject: |
Re: tablature.ly - please test and comment |
Date: |
Fri, 22 May 2009 23:05:35 +0100 |
2009/5/22 Marc Hohl <address@hidden>:
> Please have a look at it and reply any corrections/improvements/changes
> /etc.
> before I will send patches to Carl.
Well done Marc, this is very promising.
I still have a few reservations concerning some details (mostly
minor), which I'll comment on below.
> %%%% tablature.ly
> %%%%
> %%%% source file of the GNU LilyPond music typesetter
> %%%%
> %%%% (c) 2009 Marc Hohl <address@hidden>
>
>
> % some publications use the triangled note head
> % for palm mute, so here we go:
> palmMuteOn = { \set shapeNoteStyles = #(make-vector 7 'do) }
> palmMuteOff = { \unset shapeNoteStyles }
> % for single notes (or groups of notes within { ...} :
> palmMute = #(define-music-function (parser location notes) (ly:music?)
#(define-music-function ... on a new line (see the formatting style
for music functions in music-functions-init.ly).
> #{
> \palmMuteOn
> $notes
> \palmMuteOff
> #})
Fix indentation (two spaces).
> % x-tab-format uses a "x" instead of the fret number:
> #(define (x-tab-format str context event)
> (make-whiteout-markup
> (make-vcenter-markup
> (markup #:musicglyph "noteheads.s2cross"))))
>
> % dead notes are marked with a cross-shape note head,
> % both in normal notation and in tablature:
> deadNotesOn = {
> \override NoteHead #'style = #'cross
> \set tablatureFormat = #x-tab-format
Indent two spaces only.
> }
> deadNotesOff = {
> \unset tablatureFormat
> \revert NoteHead #'style
Fix indentation.
> }
> % for single notes or groups of notes within {...}:
> deadNotes = #(define-music-function (parser location notes) (ly:music?)
> #{
> \deadNotesOn
> $notes
> \deadNotesOff
> #})
Music function formatting as above.
>
> % definitions for the "moderntab" clef:
> % the "moderntab" clef will be added to the list of known clefs,
> % so it can be used as any other clef:
> %
> % \clef "moderntab"
> %
> #(add-new-clef "moderntab" "markup.moderntab" 0 0 0)
>
> % this function decides which clef to take
> #(define (clef::print-modern-tab-if-set grob)
> (let* ((glyph (ly:grob-property grob 'glyph)))
Use let here.
> % if the stems are drawn, it is nice to have a double stem for
> % (dotted) half notes to distinguish them from quarter notes:
> #(define-public (tabvoice::draw-double-stem-for-half-notes grob)
> ;; is the note a (dotted) half note?
> (if (= 1 (ly:grob-property grob 'duration-log))
> ;; yes -> draw double stem
> (ly:stencil-combine-at-edge
> (ly:stem::print grob) 0 1
> (ly:stem::print grob) 0.5 0 )
> ;; no -> draw simple stem
> (ly:stem::print grob)))
Too many (ly:stem::print grob) forms here; better to use let to define
the stencil.
>
> % as default, the glissando line between fret numbers goes
> % upwards, here we have a function to correct this behavior:
> #(define-public (glissando::calc-tab-extra-dy grob)
> (let* ((original (ly:grob-original grob))
> (left-bound (ly:spanner-bound original LEFT))
> (right-bound (ly:spanner-bound original RIGHT))
> (left-pitch (ly:event-property (event-cause left-bound) 'pitch))
> (right-pitch (ly:event-property (event-cause right-bound) 'pitch))
> (left-staff-position (ly:grob-property left-bound 'staff-position))
> (right-staff-position (ly:grob-property right-bound
> 'staff-position)))
>
> (if (and (= left-staff-position right-staff-position)
> (< (ly:pitch-semitones right-pitch) (ly:pitch-semitones
> left-pitch)))
> -0.75
> 0.75 )))
I think it looks better if you leave out the staff-position
comparison, otherwise all glissandos (up or down) between noteheads on
different strings get the same positive 'extra-dy.
>
>
> % for ties in tablature, fret numbers that are tied to should be invisible
> % or -after a line break - put in parentheses. Since this is not (easily?)
> % possible in lilypond, we offer three commands:
> %
> % \clearTabTieBreaks simply makes all tied numbers invisible,
> % \drawTabTieBreaks draws numbers that follow a line break
> % \markTabTieBreaks draws a red fret number and gives a
> % warning message on the terminal, so the user can put the
> % parentheses manually and finally changes \mark... with \draw...
>
> #(define (tie::tab-clear-tied-fret-numbers grob)
> (let* ((tied-fret-nr (ly:spanner-bound grob RIGHT)))
> (ly:grob-set-property! tied-fret-nr 'transparent #t)))
>
> #(define (tie::tab-draw-tied-fret-numbers grob)
> (let* ((original (ly:grob-original grob))
> (tied-fret-nr (ly:spanner-bound grob RIGHT))
> (siblings (if (ly:grob? original)
> (ly:spanner-broken-into original) '() )))
>
> (if (and (>= (length siblings) 2)
> (eq? (car (last-pair siblings)) grob))
> ;; tie is split -> make fret number visible
> (ly:grob-set-property! tied-fret-nr 'transparent #f)
> ;; tie is not split -> make fret number invisible
> (ly:grob-set-property! tied-fret-nr 'transparent #t))))
>
> #(define (tie::tab-mark-tied-fret-numbers grob)
> (let* ((original (ly:grob-original grob))
> (tied-fret-nr (ly:spanner-bound grob RIGHT))
> (siblings (if (ly:grob? original)
> (ly:spanner-broken-into original) '() )))
>
> (if (and (>= (length siblings) 2)
> (eq? (car (last-pair siblings)) grob))
> ;; tie is split -> change fret number color to red and
> print a message
> (begin (display "\nSplit tie appears in tablature.")
> (display "\nAffected fret number is marked red.\n")
> (ly:grob-set-property! tied-fret-nr 'color red))
> ;; tie is not split -> make fret number invisible
> (ly:grob-set-property! tied-fret-nr 'transparent #t))))
>
> clearTabTieBreaks = {
> \override Tie #'after-line-breaking = #tie::tab-clear-tied-fret-numbers
> }
>
> drawTabTieBreaks = {
> \override Tie #'after-line-breaking = #tie::tab-draw-tied-fret-numbers
> }
>
> markTabTieBreaks = {
> \override Tie #'after-line-breaking = #tie::tab-mark-tied-fret-numbers
> }
Since none of this works properly (I suspect it will require more than
Scheme hacking to get everything working), I don't think it's suitable
for inclusion.
>
> % commands for switching between tablature with numbers only...
> tabNumbersOnly = {
> % no time signature
> \override TabStaff.TimeSignature #'stencil = ##f
> % no stems, beams, dots, ties and slurs
> \override TabVoice.Stem #'stencil = ##f
> \override TabVoice.Beam #'stencil = ##f
> \override TabVoice.Dots #'stencil = ##f
> \override TabVoice.Tie #'stencil = ##f
> \override TabVoice.Slur #'stencil = ##f
> % no tuplet stuff
> \override TabVoice.TupletBracket #'stencil = ##f
> \override TabVoice.TupletNumber #'stencil = ##f
> % no dynamic signs, text spanners etc.
> \override DynamicText #'transparent = ##t
> \override DynamicTextSpanner #'stencil = ##f
> \override TextSpanner #'stencil = ##f
> \override Hairpin #'transparent = ##t
> % no rests
> \override TabVoice.Rest #'stencil = ##f
> \override TabVoice.MultiMeasureRest #'stencil = ##f
> % no markups
> \override TabVoice.Script #'stencil = ##f
> \override TabVoice.TextScript #'stencil = ##f
> }
> % and the full notation
> tabFullNotation = {
> % time signature
> \revert TabStaff.TimeSignature #'stencil
> % stems
> \override TabVoice.Stem #'stencil =
> #tabvoice::draw-double-stem-for-half-notes
> % beams, dots
> \revert TabVoice.Beam #'stencil
> \revert TabVoice.Dots #'stencil
> \revert TabVoice.Tie #'stencil
> \revert TabVoice.Slur #'stencil
> % tuplet stuff
> \revert TabVoice.TupletBracket #'stencil
> \revert TabVoice.TupletNumber #'stencil
> % dynamic signs
> \revert DynamicText #'transparent
> \override DynamicTextSpanner #'stencil = ##f
> \revert TabVoice.DynamicTextSpanner #'stencil
> \revert TabVoice.Hairpin #'transparent
> % rests
> \revert TabVoice.Rest #'stencil
> \revert TabVoice.MultiMeasureRest #'stencil
> % markups
> \revert TabVoice.Script #'stencil
> \revert TabVoice.TextScript #'stencil
> }
Fix indentation for both of these identifiers.
>
> % the defaults for tablature:
> % the clef handler will be included and the tablature
> % is displayed \tabNumbersOnly-style:
> \layout {
> \context {
> \TabStaff
> % the clef handler
> \override Clef #'stencil = #clef::print-modern-tab-if-set
> % no time signature
> \override TimeSignature #'stencil = ##f
> % behaviour of split ties
> \override Tie #'after-line-breaking = #tie::tab-clear-tied-fret-numbers
> }
> \context {
> \TabVoice
> \override Stem #'stencil = ##f
> \override Beam #'stencil = ##f
> \override Dots #'stencil = ##f
> \override Tie #'stencil = ##f
> \override Slur #'stencil = ##f
> % the direction for glissando lines will be automatically corrected
> \override Glissando #'extra-dy = #glissando::calc-tab-extra-dy
> \override TupletBracket #'stencil = ##f
> \override TupletNumber #'stencil = ##f
> \override DynamicText #'transparent = ##t
> \override DynamicTextSpanner #'stencil = ##f
> \override TextSpanner #'stencil = ##f
> \override Hairpin #'transparent = ##t
> \override Rest #'stencil = ##f
> \override MultiMeasureRest #'stencil = ##f
> \override Script #'stencil = ##f
> \override TextScript #'stencil = ##f
> }
> }
I'm concerned about the amount of duplication here; this basically
repeats all the code in \tabNumbersOnly, which is really something we
should try to avoid in included files.
Regards,
Neil
- tablature.ly - please test and comment, Marc Hohl, 2009/05/22
- Re: tablature.ly - please test and comment,
Neil Puttock <=
- Re: tablature.ly - please test and comment, Marc Hohl, 2009/05/23
- Re: tablature.ly - please test and comment, Neil Puttock, 2009/05/27
- Re: tablature.ly - please test and comment, Carl D. Sorensen, 2009/05/27
- Re: tablature.ly - please test and comment, Marc Hohl, 2009/05/28
- Re: tablature.ly - please test and comment, Carl D. Sorensen, 2009/05/28
Re: tablature.ly - please test and comment, Julian, 2009/05/25