tablature.ly, second attempt

2009-05-04 Thread Marc Hohl

Hello tablature users,

after sending my first version of a tablature.ly-file, I got a lot of 
positive resonse,

and a lot more of corrections/improvements. Thank you all!

Now, there is a (hopefully) better file which includes the following 
features/changes:


1) the palmmute/deadnote stuff is the same, only the code has been 
simplified, thanks to Neil's proposals


2) the \tabNumbersOnly settings are now the default, so when 
tablature.ly is included, the stems etc. are gone

  (as proposed by Grammostola Rosea)

3) the modern tab clef is now available as any other clef by typing 
\clef moderntab


To implement (3), there is another function necessary, which will be in 
future releases of lilypond, but

for now, you have to insert the following lines into scm/parser-clef.scm:

;; a function to add new clefs at runtime
(define-public (add-new-clef clef-name clef-glyph clef-position 
octavation c0-position)
 Append the entries for a clef symbol to supported-clefs and 
c0-pitch-alist

 (set! supported-clefs
   (acons clef-name (list clef-glyph clef-position octavation) 
supported-clefs))

 (set! c0-pitch-alist
   (acons clef-glyph c0-position c0-pitch-alist)))

Otherwise the new clef definition won't work.

Thanks again to Carl and Neil for their help!

There is one problem now with the settings in tablature.ly: I simply 
made ties transparent, but
then, the fret number appears as it were a note to be played. Hopefully 
somewhere in the future,
I will find a possibility to let the fret number disappear, but as David 
Stocerk pointed out,
some cases had to be  distinguished (the following is a quote from a 
former posting from David):


(quote...)

It should be noted that a publishing standard is when there is a Note 
Staff + Tab Staff, tied notes (that is, the notes that are 'held') in 
the Tab Staff are indicated by parenthesizing the tab number(s). There 
are several conventions that are related to tied notes in a Notes+Tab 
situation:


  * Tab numbers that are 'tied to' are sometimes parenthesized,
sometimes hidden.
  * In the case that 'tied to' notes are hidden, a parenthesized tab
number is usually forced if the 'tied to' note is at the beginning
of a line (i.e., the note is tied over a system break).
  * Likewise, parenthesized tab numbers are forced when a 'tied to'
note begins a 2nd ending or Coda section.
  * A parenthesized chord in the Tab Staff are indicated with a single
pair of parentheses surrounding all of the notes in the chord (as
opposed to as single pair of parentheses around each individual
note in the chord).

(...quote)

So this seems to be a difficult task, but somehow to manage.

Marc



 tablature.ly

 source file of the GNU LilyPond music typesetter

 (c) 2009 Marc Hohl m...@hohlart.de


% 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?)
  #{
 \palmMuteOn $notes \palmMuteOff
  #})

% 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?)
   #{
  \deadNotesOn  $notes \deadNotesOff
   #})

% 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)))
  ;; which clef is wanted?
  (if (string=? glyph markup.moderntab)
  ;; if it is moderntab, we'll draw it
  (let* ((staff-symbol (ly:grob-object grob 'staff-symbol))
 (line-count   (ly:grob-property staff-symbol 'line-count))
 (staff-space  (ly:grob-property staff-symbol 'staff-space 
1)))
(grob-interpret-markup grob (make-customTabClef-markup 
line-count staff-space)))
  ;; otherwise, we simply use the default printing routine
  (ly:clef::print grob

% define sans serif-style tab-Clefs as a markup:
#(define-markup-command (customTabClef layout props num-strings staff-space) 
(integer? number?)
(define (square x) (* x x))
(let* ((scale-factor (/ staff-space 

Re: tablature.ly, second attempt

2009-05-04 Thread rosea grammostola
Great job!
Really appreciate it!

\r

On Mon, May 4, 2009 at 9:47 AM, Marc Hohl m...@hohlart.de wrote:

 Hello tablature users,

 after sending my first version of a tablature.ly-file, I got a lot of
 positive resonse,
 and a lot more of corrections/improvements. Thank you all!

 Now, there is a (hopefully) better file which includes the following
 features/changes:

 1) the palmmute/deadnote stuff is the same, only the code has been
 simplified, thanks to Neil's proposals

 2) the \tabNumbersOnly settings are now the default, so when tablature.lyis 
 included, the stems etc. are gone
  (as proposed by Grammostola Rosea)

 3) the modern tab clef is now available as any other clef by typing \clef
 moderntab

 To implement (3), there is another function necessary, which will be in
 future releases of lilypond, but
 for now, you have to insert the following lines into scm/parser-clef.scm:

 ;; a function to add new clefs at runtime
 (define-public (add-new-clef clef-name clef-glyph clef-position octavation
 c0-position)
  Append the entries for a clef symbol to supported-clefs and
 c0-pitch-alist
  (set! supported-clefs
   (acons clef-name (list clef-glyph clef-position octavation)
 supported-clefs))
  (set! c0-pitch-alist
   (acons clef-glyph c0-position c0-pitch-alist)))

 Otherwise the new clef definition won't work.

 Thanks again to Carl and Neil for their help!

 There is one problem now with the settings in tablature.ly: I simply made
 ties transparent, but
 then, the fret number appears as it were a note to be played. Hopefully
 somewhere in the future,
 I will find a possibility to let the fret number disappear, but as David
 Stocerk pointed out,
 some cases had to be  distinguished (the following is a quote from a former
 posting from David):

 (quote...)

 It should be noted that a publishing standard is when there is a Note Staff
 + Tab Staff, tied notes (that is, the notes that are 'held') in the Tab
 Staff are indicated by parenthesizing the tab number(s). There are several
 conventions that are related to tied notes in a Notes+Tab situation:

  * Tab numbers that are 'tied to' are sometimes parenthesized,
sometimes hidden.
  * In the case that 'tied to' notes are hidden, a parenthesized tab
number is usually forced if the 'tied to' note is at the beginning
of a line (i.e., the note is tied over a system break).
  * Likewise, parenthesized tab numbers are forced when a 'tied to'
note begins a 2nd ending or Coda section.
  * A parenthesized chord in the Tab Staff are indicated with a single
pair of parentheses surrounding all of the notes in the chord (as
opposed to as single pair of parentheses around each individual
note in the chord).

 (...quote)

 So this seems to be a difficult task, but somehow to manage.

 Marc




  tablature.ly
 
  source file of the GNU LilyPond music typesetter
 
  (c) 2009 Marc Hohl m...@hohlart.de


 % 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?)
  #{
 \palmMuteOn $notes \palmMuteOff
  #})

 % 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?)
   #{
  \deadNotesOn  $notes \deadNotesOff
   #})

 % 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)))
  ;; which clef is wanted?
  (if (string=? glyph markup.moderntab)
  ;; if it is moderntab, we'll draw it
  (let* ((staff-symbol (ly:grob-object grob 'staff-symbol))
 (line-count   (ly:grob-property staff-symbol
 'line-count))
 (staff-space  (ly:grob-property staff-symbol
 'staff-space 1)))
(grob-interpret-markup grob (make-customTabClef-markup
 line-count staff-space)))
  ;; otherwise, we simply use the default printing routine
  (ly:clef::print grob

 % define sans serif-style tab-Clefs as a markup:
 

Bracketed notes

2009-05-04 Thread Mark Austin
Is it possible to enclose a note in brackets? I need to do this to
indicate a lead note played the first time but not on subsequent
repeats.

-- 
Mark Austin

--
For Whigs admit no force but argument
--


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Bracketed notes

2009-05-04 Thread Robin Bannister

Mark Austin wrote:

Is it possible to enclose a note in brackets?


Use \parenthesize 
http://lilypond.org/doc/v2.12/Documentation/user/lilypond/Inside-the-staff#Parentheses


Cheers,
Robin


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Bracketed notes

2009-05-04 Thread Mats Bengtsson
Take a look at 
http://lilypond.org/doc/v2.12/Documentation/user/lilypond/Inside-the-staff#Parentheses


  /Mats

Mark Austin wrote:

Is it possible to enclose a note in brackets? I need to do this to
indicate a lead note played the first time but not on subsequent
repeats.

  


--
=
Mats Bengtsson
Signal Processing
School of Electrical Engineering
Royal Institute of Technology (KTH)
SE-100 44  STOCKHOLM
Sweden
Phone: (+46) 8 790 8463 
   Fax:   (+46) 8 790 7260
Email: mats.bengts...@ee.kth.se
WWW: http://www.s3.kth.se/~mabe
=



___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Bracketed notes

2009-05-04 Thread Jonathan Kulp

Mark Austin wrote:

Is it possible to enclose a note in brackets? I need to do this to
indicate a lead note played the first time but not on subsequent
repeats.



In a thread a while back we came up with a way to put brackets (not 
parentheses) around a rest.  You could try it with your lead note, too:


http://www.nabble.com/bracketed-silence-td18414197.html#a18414406

HTH,

Jon
--
Jonathan Kulp
http://www.jonathankulp.com


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Bracketed notes

2009-05-04 Thread Reinhold Kainhofer
Am Montag, 4. Mai 2009 17:28:54 schrieb Jonathan Kulp:
 Mark Austin wrote:
  Is it possible to enclose a note in brackets? I need to do this to
  indicate a lead note played the first time but not on subsequent
  repeats.

 In a thread a while back we came up with a way to put brackets (not
 parentheses) around a rest.  You could try it with your lead note, too:

Another possibility is to hook into the way \parenthesize formats the 
parentheses: It obtains stencils for the opening and closing parentheses, so 
one was is to simply override them with opening and closing brackets. See the 
attached snippet, which defines a \bracketify command, which can be used almost 
like \parenthesize (bracketing individual notes of a chord doesn't work due to 
my use of \once\override inside the function).

Cheers,
Reinhold

-- 
--
Reinhold Kainhofer, reinh...@kainhofer.com, http://reinhold.kainhofer.com/
 * Financial  Actuarial Math., Vienna Univ. of Technology, Austria
 * http://www.fam.tuwien.ac.at/, DVR: 0005886
 * LilyPond, Music typesetting, http://www.lilypond.org
\version 2.13.1

#(define-public (bracket-stencils grob)
  (let* ((font (ly:grob-default-font grob))
 (layout (ly:grob-layout grob))
 (props (ly:grob-alist-chain grob (ly:output-def-lookup layout 'text-font-defaults)))
	 (lp (ly:text-interface::interpret-markup layout props (markup #:fontsize 3.5 #:translate (cons -0.3 -0.5) [)))
	 (rp (ly:text-interface::interpret-markup layout props (markup #:fontsize 3.5 #:translate (cons -0.3 -0.5) ]
(list lp rp)))

bracketify = #(define-music-function (parser loc arg) (ly:music?)
   (_i Tag @var{arg} to be parenthesized.)
#{
  \once \override ParenthesesItem #'stencils = #bracket-stencils
  \parenthesize $arg
#}
)

\relative c'' {
  c4 
  \parenthesize c 
  \bracketify c4 
  \bracketify g4 
%e \bracketify g b   % This doesn't work!!!
  \bracketify  e g b  
  \bracketify r4 
}

bracket.pdf
Description: Adobe PDF document
___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Bracketed notes

2009-05-04 Thread Jonathan Kulp

Reinhold Kainhofer wrote:

Am Montag, 4. Mai 2009 17:28:54 schrieb Jonathan Kulp:

Mark Austin wrote:

Is it possible to enclose a note in brackets? I need to do this to
indicate a lead note played the first time but not on subsequent
repeats.

In a thread a while back we came up with a way to put brackets (not
parentheses) around a rest.  You could try it with your lead note, too:


Another possibility is to hook into the way \parenthesize formats the 
parentheses: It obtains stencils for the opening and closing parentheses, so 
one was is to simply override them with opening and closing brackets. See the 
attached snippet, which defines a \bracketify command, which can be used almost 
like \parenthesize (bracketing individual notes of a chord doesn't work due to 
my use of \once\override inside the function).



Genius, Reinhold!  Very nice.

Jon

--
Jonathan Kulp
http://www.jonathankulp.com


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: horizontal alignment suggestions

2009-05-04 Thread Neil Puttock
2009/5/3 Kieren MacMillan kieren_macmil...@sympatico.ca:

 There's likely a way to make a Scheme function which automatically
 \translate-s the text the correct amount, but I don't have time to
 investigate it.

Since the instrument name conveniently makes up the negative part of
the score markup's horizontal extent, the easiest workaround is to
remove it from the score's bounding box.

The following markup command performs a selective \with-dimensions on
a markup without having to work out the extent of the instrument name:

#(define-markup-command (ignoreInstrumentName layout props score) (markup?)
  (let* (
 ;; get stencil from markup
 (stencil (interpret-markup layout props score))
 ;; get dimensions of stencil in X and Y axes
 (x-extent (ly:stencil-extent stencil X))
 (y-extent (ly:stencil-extent stencil Y)))

;; reset left part of x-extent so it's the same as
;; a score markup without an instrument name
(set-car! x-extent -0.2)
;; return a copy of original stencil with altered bounding box
(ly:make-stencil (ly:stencil-expr stencil) x-extent y-extent)))

\markup {
  \fill-line {
\ignoreInstrumentName
\score {
  \new Staff \with { instrumentName = Instrument Name } { a4 g a f }
  \layout { indent = 0 }
}
  }
}
\markup {
  \fill-line {
\score {
  \new Staff { a4 g a f }
  \layout { indent = 0 }
}
  }
}

Regards,
Neil


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: collision with crescendo text

2009-05-04 Thread -Eluze


kontrapunktstefan wrote:
 
 Dear community,
 in the below quoted snippet, the crescendo -text should have more space.
 
 
may be the code below helps to find a solution (derived from 
http://www.nabble.com/Dynamic-extender-line%3A-regression-to18514160.html#a18519588
http://www.nabble.com/Dynamic-extender-line%3A-regression-to18514160.html#a18519588
):

\paper {
  ragged-right =##f 
  }
mySforzato={
  \override  DynamicTextSpanner #'bound-details =#'(
(right . (
  (attach-dir .  ,RIGHT)
  (Y . 0)
(stencil-offset . (.05 . -0.5))
   (padding . 0)
   ) )
(left . (
  (attach-dir .  ,LEFT)
  (Y . 0)
  (stencil-offset . (-.75 . -0.5))
  (padding . 0)
  ) ) )
  \crescTextCresc
  \override DynamicTextSpanner #'(bound-details right  text) = \markup
\dynamic sf
  \override DynamicTextSpanner #'(style) = #'dotted-line
  \override DynamicTextSpanner #'(dash-period) = #'0.4
  }
{ 
  \mySforzato
  \clef G_8
  bes2 \ des \! c1
  }

also you might have to play around with the numbers or make sure that the
distance between the spanned notes is sufficient!
-- 
View this message in context: 
http://www.nabble.com/collision-with-crescendo-text-tp23358930p23377472.html
Sent from the Gnu - Lilypond - User mailing list archive at Nabble.com.



___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: How to create shortcut to a command?

2009-05-04 Thread Marc Mouries
Thanks a lot guys this is helpful. I am trying to make the lily code  
easier to read.


I also have many command to write the position like ^\markup { \small  
IV } and ^\markup { \small  } and so on, would you know how  
to create a command that takes an argument?


On Apr 27, 2009, at 6:09 AM, Francisco Vila wrote:


2009/4/27 Dmytro O. Redchuk brownian@gmail.com:

2009/4/27 Francisco Vila paconet@gmail.com:

2009/4/27 Dmytro O. Redchuk brownian@gmail.com:

% or even, i guess, this should work:
note _\markup { \italic poco \rit }


Yes, it does, but how would you do it for \upbow and \downbow?

:-)

Don't know.


I have investigated a bit how downbow is defined and I've found it in
the source code in ly/script-init.ly so we can write

db = #(make-articulation downbow)
ub = #(make-articulation upbow)

{ c' \db c' \ub }


--
Francisco Vila. Badajoz (Spain)
www.paconet.org




___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Bracketed notes

2009-05-04 Thread Kieren MacMillan

Hi all,

Another option is to (ab)use the Arpeggio, as seen in the attached  
snippet (which uses Mark P's postscript parens).


Cheers,
Kieren.

\version 2.12.2

leftPar = \markup
{
\postscript
#(let ((width 0.75)
(height -4)
(edge-thickness 0.1)
(center-thickness 0.3))
(ly:format
/w ~a def /h ~a def /t0 ~a def /t1 ~a def /x1 t1 t0 sub def
/y1 1 3 div h mul def /y2 2 3 div h mul def
currentpoint translate t0 setlinewidth 1 setlinecap 1 
setlinejoin
w 0 moveto 0 y1 0 y2 w h curveto x1 y2 x1 y1 w 0 curveto
gsave fill grestore stroke
 width height edge-thickness center-thickness))
}

rightPar = \markup
{
\postscript
#(let ((width 0.75)
(height -4)
(edge-thickness 0.1)
(center-thickness 0.3))
(ly:format
/w ~a def /h ~a def /t0 ~a def /t1 ~a def /x1 w t1 t0 sub sub 
def
/y1 1 3 div h mul def /y2 2 3 div h mul def
currentpoint translate t0 setlinewidth 1 setlinecap 1 
setlinejoin
0 0 moveto w y1 w y2 0 h curveto x1 y2 x1 y1 0 0 curveto
gsave fill grestore stroke
 width height edge-thickness center-thickness))
}

parenArp =
{
\once \override Arpeggio #'stencil = #ly:text-interface::print
	\once \override Arpeggio #'text = \markup { \hspace #-0.4 \leftPar  
\hspace #1.6 \rightPar }

}

parenChord = \relative
{
\parenArp c e g
}

\score
{
\parenChord
}


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: horizontal alignment suggestions

2009-05-04 Thread Kieren MacMillan

Neil,

Nice!

Kieren.


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user