[LAU] [Fwd: tablature.ly]

Ken Restivo ken at restivo.org
Mon Apr 27 20:28:53 EDT 2009


On Sat, Apr 25, 2009 at 12:21:36PM +0200, Grammostola Rosea wrote:
>

> Date: Sat, 25 Apr 2009 12:06:07 +0200
> From: Marc Hohl <marc at hohlart.de>
> To: lilypond-user at gnu.org, "Carl D. Sorensen" <c_sorensen at byu.edu>,
> 	David Stocker <dstocker at thenotesetter.com>,
> 	Grammostola Rosea <rosea.grammostola at gmail.com>
> Subject: tablature.ly
> 
> Hello tablature users*,
>
> after some days of struggling with lilypond's internals, I have created  
> a file tablature.ly
> which supports:
>
> 1) two commands to switch between the display style:
>   \tabNumbersOnly shows only the mubers,
>   \tabFullNotation shows up everything (as it is the default in  
> \TabVoice upto now)
>
> 2) two commands for the possible clefs:
>   \calligraphicTabClef #<tuning>
>   \sansSerifTabClef #<tuning>
>   (I didn't like "modern" or "old" clef, so I used commands which  
> describe the apperance
>   of the clefs).
>   The sans serif clef is available for 4 to 7 strings. It internally sets
>   \TabStaff.stringTunings to <tuning>.
>
> 3) some more tunings are defined:
>   guitar-seven-string-tuning
>   guitar-drop-d-tuning        bass-four-string-tuning     
> bass-drop-d-tuning         bass-five-string-tuning     
> bass-six-string-tuning
>   (yes I know, the already defined "bass-tuning" is the same as my  
> "bass-four-string-tuning", but
>    as I write music for various basses, this is easier to read at first  
> glance.)
>
> 4) commandos for palm mute playing and dead notes are supported (palm  
> mute is not a tablature-specific
>   issue, but as electric guitar players use tablature and often play  
> palm mute, I think this is ok).
>   At first I thought of using \x for dead notes, but in other threads \x 
> is used for almost everything,
>   so I leave it to the user to say x = \deadNotes and use \x for faster  
> typing myriads of dead notes :-)
>
> I post this along with a test file, so you can check this out.
>
> *Carl, which isn't really a tablature user, has given me a lot of  
> support an insight to lilypond,
> and he proposed to include tablature.ly in future releases of lilypond,  
> so this would be the place to
> go for further development (bendings, etc.). Establishing  
> \tabNumbersOnly as a standard would mean to
> break with older versions, but as it is a single command, this should  
> not be considered as a serious
> drawback.
>
> As there are more people invoved in developing tablature extensions for  
> lilypond, I send tablature.ly
> to this list for testing purposes, so changes, corrections etc. could be  
> discussed before establishing
> the file in future versions. As I said before, it is just a starting  
> point, any suggestions, improvements
> etc. are welcome. Are there other tunings we should consider being  
> defined internally?
>
> Yet again, I would like to thank Carl for his great help and patience,  
> and as far as I can see now,
> making contributions to lilypond is easier than one might think, there  
> are a lot of people outside
> willing to help you, if you are willing to bring lilypond further on, so  
> give it a try!
>
> Greetings,
>
> Marc

> % tablature.ly
> 
> % these definitions will be moved to scm/output-lib.scm
> #(define-public guitar-seven-string-tuning '(4 -1 -5 -10 -15 -20 -25))
> #(define-public guitar-drop-d-tuning       '(4 -1 -5 -10 -15 -22))
> #(define-public bass-four-string-tuning    '(-17 -22 -27 -32))
> #(define-public bass-drop-d-tuning         '(-17 -22 -27 -34))
> #(define-public bass-five-string-tuning    '(-17 -22 -27 -32 -37))
> #(define-public bass-six-string-tuning     '(-12 -17 -22 -27 -32 -37))
> 
> 
> 
> % some publications use the triangled note head 
> % for palm mute, so here we go:
> palmMuteOn = { \set shapeNoteStyles = #'#(do do do do do do do ) }
> palmMuteOff = { \unset shapeNoteStyles }
> % for single notes (or groups of notes within { ...} :
> palmMute =  #(define-music-function (parser location note) (ly:music?)
>       #{ 
>          \set shapeNoteStyles = #'#(do do do do do do do )
>          $note
>          \unset shapeNoteStyles
>       #})
> 
> % 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
> }
> deadNotesOff = {
>    \unset tablatureFormat
>    \revert NoteHead #'style
> }
> % for single notes or groups of notes within {...}:
> deadNotes = #(define-music-function (parser location notes) (ly:music?)
>    #{
>       \override NoteHead #'style = #'cross
>       \set tablatureFormat = #x-tab-format
>       $notes
>       \unset tablatureFormat
>       \revert NoteHead #'style
>    #})
> 
> % define sans serif-style tab-Clefs according to
> % http://lsr.dsi.unimi.it/LSR/Item?id=323
> % for 4, 5, 6 and 7 strings
> 
> #(define-markup-command (customTabClef layout props tuning) (pair?)
>     (let* ((num-strings (length tuning))
>            ;; the number of strings has to be in 4...7
>            (num-strings (cond ((< num-strings 4) 4)
>                               ((> num-strings 7) 7)
>                               (else num-strings)))
>            (raise-value (- (* num-strings 0.4) 0.9))
>            (font-size (- (* num-strings 1.5) 7))
>            (base-skip (cond ((= 4 num-strings) 1.55)
>                             ((= 5 num-strings) 1.84)
>                             ((= 6 num-strings)  2.00)
>                             ((= 7 num-strings) 2.08)))
>            (new-props (cons (list
>                               '(font-family . sans)
>                               (cons 'baseline-skip base-skip))
>                              props)))
>        (interpret-markup layout new-props
>          (markup #:raise raise-value #:bold #:fontsize font-size
>                 #:column ("T" "A" "B")))))
> 
> % Wrappers for the different clefs
> % the argument is the string-tuning, which is automatically set.
> sansSerifTabClef = #(define-music-function (parser location tuning) (pair?)
>    #{
>       \override TabStaff.Clef #'stencil = #ly:text-interface::print
>       \override TabStaff.Clef #'text = \markup \customTabClef $tuning
>       \set TabStaff.stringTunings = $tuning
>    #})
> 
> calligraphicTabClef = #(define-music-function (parser location tuning) (pair?)
>    #{
>       \revert TabStaff.Clef #'stencil
>       \set TabStaff.stringTunings = $tuning
>    #})
> 
> % 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, beams, dots
>    \revert TabVoice.Stem #'stencil
>    \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
> }

> \version "2.12.2"
> \include "tablature.ly"
> 
> \markup {First, a lot of stuff as it is displayed both in notation and in tablature.}
> 
> alotofstuff = { 
>    \time 3/4
>    c4^"test" d( e) 
>    f4\f g a^\fermata
>    c8\< c16 c ~ c2\!
>    c'2.
>    \mark \default
>    R2.
>    r4 d4 r8 r
>    \times 3/4 { b4 c d c }
>    c4. d-_( e\varcoda)
>    ->f g~ a\prall g\thumb e-. f-. g-.
>    \times 3/4 { b4 c d c }
>    \bar "|."
> }
> 
> \score {
>    <<
>       \new Staff \alotofstuff
>       \new TabStaff \alotofstuff
>    >>
> }
> 
> \markup{When we invoke tabNumbersOnly, it looks better.}
> 
> \score {
>    <<
>       \new Staff \alotofstuff
>       \new TabStaff   { \tabNumbersOnly \alotofstuff }
>    >>
> }
> 
> \markup{ tablature.ly supports an easy way to mark notes as played palm mute-style...}
> 
> palmmute = \relative c, {
>     \time 4/4
>     e8^\markup { \musicglyph #"noteheads.u2do"  = palm mute } \palmMuteOn e e \palmMuteOff  e e  \palmMute e e e
>     e8 \palmMute { e e e } e e e e 
>     \palmMuteOn
>     < e b' e>8 e e e <e b' e>2
>     \bar "|."
> }
> 
> \score {
>    <<
>       \new Staff { \clef "G_8" \palmmute }
>       \new TabStaff  { \tabNumbersOnly 
>                        \calligraphicTabClef #guitar-tuning
>                        \palmmute }
>    >>
> }
> 
> \markup {... or dead notes:}
> 
> deadnotes = \relative c,, {
>    e8. \deadNotesOn e16 \deadNotesOff g4 a b
>    e8. \deadNotes e16 g4 a b
>    e,4. \deadNotes { e8 e e } e4
>    \bar "|."
> }
> 
> \score {
>    <<
>       \new Staff { \clef "bass_8" \deadnotes }
>       \new TabStaff  { \tabNumbersOnly 
>                        \sansSerifTabClef #bass-four-string-tuning
>                        \deadnotes }
>    >>
> }
> 
> \markup { The new sansSerifTab-Clef supports tablatures from 4 to 7 strings.}
> % some stuff 
> bass = \relative c,, {
>    e4 g a b
>    b4 f g d'
>    \bar "|."
> }
> 
> % four strings, calculated clef
> \score {
>    <<
>       \new Staff { \mark \markup{4 strings}
>                    \clef "bass_8" \bass }
>       \new TabStaff   { \tabNumbersOnly 
>                         \sansSerifTabClef #bass-four-string-tuning
>                         \bass }
>    >>
> }
> 
> % five strings, calculated clef
> \score {
>    <<
>       \new Staff { \mark \markup{5 strings}
>                    \clef "bass_8" \bass }
>       \new TabStaff   { \tabNumbersOnly 
>                         \sansSerifTabClef #bass-five-string-tuning
>                         \bass }
>    >>
> }
> 
> guitar = \relative c {
>    c4 d e f
>    g4 a b c 
>    \bar "|."
> }
> 
> % six strings, calculated clef
> \score {
>    <<
>       \new Staff { \mark \markup{6 strings}
>                    \clef "G_8" \guitar }
>       \new TabStaff   { \tabNumbersOnly 
>                         \sansSerifTabClef #guitar-tuning
>                         \guitar }
>    >>
> }
> 
> % seven strings, calculated clef
> \score {
>    <<
>       \new Staff { \mark \markup{7 strings}
>                    \clef "G_8" \guitar }
>       \new TabStaff   { \tabNumbersOnly 
>                         \sansSerifTabClef #guitar-seven-string-tuning
>                         \guitar }
>    >>
> }
> 


What a strange language!

Looks like a cross between Scheme and PostScript.

Cool, nice that it has tab capability now.

-ken



More information about the Linux-audio-user mailing list