set page number

2021-02-07 Thread bobr...@centrum.is
I have a series of scores in a small book.  I want to have the first couple of 
pages numbered in Roman numerals and then switch to Arabic.  I have 
accomplished that.  The problem I face now is that I want the first Arabic 
numbered page to be page 1.  There is '\set currentBarNumber' but there does 
not seem to be a corresponding '\set currentPageNumber' or equivalent.

There must be a way to do this.

Thanks for any help.

David



Re: set page number

2021-02-07 Thread Hwaen Ch'uqi
Greetings David,

Not knowing what you halve already, it's a bit tricky to advise.
However, here is the code that I use, given a long time ago on this
list. It may be more than you need, because it also includes
provisions for correct numbering in the Table of Contents. This first
part goes above the \book block:

%%% roman numeral page numbers
#(define begin-arabic 11)

%% The following is an adaptation of a function found in
`define-markup-commands.scm' which is used to create tables of
contents. An offset to the Arabic numerals has been incorporated so
that the first page of the music is 1.
#(define-markup-command (page-ref layout props label gauge default)
  (symbol? markup? markup?)
  #:category other
  "
@cindex referencing page numbers in text

Reference to a page number.  @var{label} is the label set on the referenced
page (using the @code{\\label} command), @var{gauge} a markup used to estimate
the maximum width of the page number, and @var{default} the value to display
when @var{label} is not found."
  (let* ((gauge-stencil (interpret-markup layout props gauge))
 (x-ext (ly:stencil-extent gauge-stencil X))
 (y-ext (ly:stencil-extent gauge-stencil Y)))
(ly:make-stencil
 `(delay-stencil-evaluation
   ,(delay (ly:stencil-expr
(let* ((table (ly:output-def-lookup layout 'label-page-table))
   (page-number (if (list? table)
(assoc-get label table)
#f))
   (page-markup
 (if page-number
 (if (< page-number begin-arabic)
 (format #f "~(~@r~)" page-number) ;
Roman numerals
 ; Arabic numerals, but offset to begin on 1
 (format #f "~a" (- (1+ page-number)
begin-arabic)))
 default))
   (page-stencil (interpret-markup layout props
page-markup))
   (gap (- (interval-length x-ext)
   (interval-length (ly:stencil-extent
page-stencil X)
  (interpret-markup layout props
(markup #:concat (#:hspace gap
page-markup)))
 x-ext
 y-ext)))

#(define-markup-command (roman-numeral-page-number layout props) ()
  (let ((page-number (chain-assoc-get 'page:page-number props -1)))
(interpret-markup layout props
  (if (> page-number 0) ; only positive integers can be `romanized'
  (format #f "~(~@r~)" page-number)
  (chain-assoc-get 'page:page-number-string props -1)

#(define-markup-command (offset-page-number layout props offset) (integer?)
  (let ((page-number (chain-assoc-get 'page:page-number props -1)))
(interpret-markup layout props
  (format #f "~a" (- page-number offset)

#(define (part-not-first-page layout props arg)
  (if (= (chain-assoc-get 'page:page-number props -1)
 (ly:output-def-lookup layout 'first-page-number))
  empty-stencil
  (interpret-markup layout props arg)))

You can change the begin-arabic number to whatever you need, the
number being the first Roman page that should have the Arabic number
1. Then, in the bookparts containing Arabic numbers, I include this in
the \paper block:

  oddHeaderMarkup = \markup {
\fill-line {
  " "
  \on-the-fly #create-page-number-stencil \offset-page-number #(1-
begin-arabic)
}
  }
  evenHeaderMarkup = \markup {
\fill-line {
  \on-the-fly #create-page-number-stencil \offset-page-number #(1-
begin-arabic)
  " "
}
  }

hth,

Hwaen Ch'uqi


On 2/7/21, bobr...@centrum.is  wrote:
> I have a series of scores in a small book.  I want to have the first couple
> of pages numbered in Roman numerals and then switch to Arabic.  I have
> accomplished that.  The problem I face now is that I want the first Arabic
> numbered page to be page 1.  There is '\set currentBarNumber' but there does
> not seem to be a corresponding '\set currentPageNumber' or equivalent.
>
> There must be a way to do this.
>
> Thanks for any help.
>
> David
>
>



Re: set page number

2021-02-07 Thread bobr...@centrum.is
This is a stripped down version of the first three pages of my input file, 
Hwaen Ch'uqi.  Do I need something as elaborate as your scheme code?  

-David


 BEGIN LILY 
\version "2.20.0"

\book {
  %
  \bookpart {
\markup \fill-line{
  \center-column {
"Title page"
  }
}
\pageBreak
  }
  %
  \bookpart {
\markup \justify{
  Page of notes.  Page "ii."
  }   
\paper {
  tagline = ""
  left-margin = 2\cm
  right-margin = 2\cm
  print-page-number = ##t
  print-first-page-number = ##f
  page-number-type = roman-lower
  oddHeaderMarkup = \markup \null
  evenHeaderMarkup = \markup \null
  oddFooterMarkup = \markup {
\fill-line {
  \on-the-fly \print-page-number-check-first
  \fromproperty #'page:page-number-string
}
  }
}
\pageBreak
  } 
  %
  \bookpart {
\score {
  \relative c {
c1
  }
}
\header {
   title = "Want this to be be page 1 not 3"
}
\paper {
  tagline = ""
}
  } % End bookpart
}
 END LILY 

- Original Message -
> From: "Hwaen Ch'uqi" 
> To: "bobroff" 
> Cc: "Lillypond Users Mailing List" 
> Sent: Sunday, February 7, 2021 11:07:22 AM
> Subject: Re: set page number

> Greetings David,
> 
> Not knowing what you halve already, it's a bit tricky to advise.
> However, here is the code that I use, given a long time ago on this
> list. It may be more than you need, because it also includes
> provisions for correct numbering in the Table of Contents. This first
> part goes above the \book block:
> 
> %%% roman numeral page numbers
> #(define begin-arabic 11)
> 
> %% The following is an adaptation of a function found in
> `define-markup-commands.scm' which is used to create tables of
> contents. An offset to the Arabic numerals has been incorporated so
> that the first page of the music is 1.
> #(define-markup-command (page-ref layout props label gauge default)
>  (symbol? markup? markup?)
>  #:category other
>  "
> @cindex referencing page numbers in text
> 
> Reference to a page number.  @var{label} is the label set on the referenced
> page (using the @code{\\label} command), @var{gauge} a markup used to estimate
> the maximum width of the page number, and @var{default} the value to display
> when @var{label} is not found."
>  (let* ((gauge-stencil (interpret-markup layout props gauge))
> (x-ext (ly:stencil-extent gauge-stencil X))
> (y-ext (ly:stencil-extent gauge-stencil Y)))
>(ly:make-stencil
> `(delay-stencil-evaluation
>   ,(delay (ly:stencil-expr
>(let* ((table (ly:output-def-lookup layout 'label-page-table))
>   (page-number (if (list? table)
>(assoc-get label table)
>#f))
>   (page-markup
> (if page-number
> (if (< page-number begin-arabic)
> (format #f "~(~@r~)" page-number) ;
> Roman numerals
> ; Arabic numerals, but offset to begin on 1
> (format #f "~a" (- (1+ page-number)
> begin-arabic)))
> default))
>   (page-stencil (interpret-markup layout props
> page-markup))
>   (gap (- (interval-length x-ext)
>   (interval-length (ly:stencil-extent
> page-stencil X)
>  (interpret-markup layout props
>(markup #:concat (#:hspace gap
> page-markup)))
> x-ext
> y-ext)))
> 
> #(define-markup-command (roman-numeral-page-number layout props) ()
>  (let ((page-number (chain-assoc-get 'page:page-number props -1)))
>(interpret-markup layout props
>  (if (> page-number 0) ; only positive integers can be `romanized'
>  (format #f "~(~@r~)" page-number)
>  (chain-assoc-get 'page:page-number-string props -1)
> 
> #(define-markup-command (offset-page-number layout props offset) (integer?)
>  (let ((page-number (chain-assoc-get 'page:page-number props -1)))
>(interpret-markup layout props
>  (format #f "~a" (- page-number offset)
> 
> #(define (part-not-first-page layout props arg)
>  (if (= (chain-assoc-get 'page:page-number props -1)
> (ly:output-def-lookup layout 'first-page-number))
>  empty-stencil
>  (interpret-markup layout props arg)))
> 
> You can change the begin-arabic number to whatever you need, the
> number being the first Roman page that should have the Arabic number
> 1. Then, in the bookparts containing Arabic numbers, I include this in
> the \paper block:
> 
>  oddHeaderMarkup = \markup {
>   \fill-line {
> " "
> \on-the-fly #create-page-number-stencil \offset-page-number #(1-
> begin-arabic)
>   }
>  }
>  evenHeaderMarkup = \markup {
>  

Guitar tab question

2021-02-07 Thread John Ward
I'm new to music notation software and I have a question. Does Lily Pond 
include the feature that allows you to write in guitar tab, convert that guitar 
tab automatically to standard notation and then cut and paste that notation to 
a piano score?
Sibelius and Muse score both have this feature. 

Thanks,

John 



Re: Guitar tab question

2021-02-07 Thread Thomas Morley
Am So., 7. Feb. 2021 um 17:23 Uhr schrieb John Ward :
>
> I'm new to music notation software and I have a question. Does Lily Pond 
> include the feature that allows you to write in guitar tab, convert that 
> guitar tab automatically to standard notation and then cut and paste that 
> notation to a piano score?
> Sibelius and Muse score both have this feature.
>
> Thanks,
>
> John
>

In LilyPond you would define a variable and call it where you want, p.e.:

\version "2.23.0"

mus = \relative a {
  a4 b c d e f g a a1
}

<<
  \new TabStaff \mus

  \new RhythmicStaff \mus

  \new ChordNames \chordmode { \mus }

  \new Staff { \clef "G_8" \mus }

  \new NoteNames \mus

  \new PianoStaff \autoChange \mus
>>

I'm not sure what you mean with "the feature that allows you to write
in guitar tab".
Tabs needs to be entered in the so called "notemode" as demonstrated above.
To write "put a finger on string two at first fret" (to get a c') is
not possible, although I remember there was in attempt in the past,
maybe look in the archives. I don't remember how good this was with
respect to enharmonics though.

Cheers,
  Harm



Re: Guitar tab question

2021-02-07 Thread Jean Bréfort
Hi,

Yes, it is possible. Actually, you enter the notes naturally and you
can get a score or a guitar tab (or both) from the same source. See
https://lilypond.org/doc/v2.22/Documentation/notation/guitar for some
simple examples.

Regards,
Jean

Le dimanche 07 février 2021 à 10:23 -0600, John Ward a écrit :
> I'm new to music notation software and I have a question. Does Lily Pond 
> include the feature that allows you to write in guitar tab, convert that 
> guitar tab automatically to standard notation and then cut and paste that 
> notation to a piano score?
> Sibelius and Muse score both have this feature. 
> 
> Thanks,
> 
> John 
> 





Posting problem

2021-02-07 Thread Sami - Vasileios Amiris
Hello.

I have, for some reason unknown to me, been blocked from posting in
nabbler. As I have never spammed, not even argued with anyone for that
matter, and in one instance the discussion from a question of mine lead to
a snippet - which means that my questions for the most part are not
trivial, is there a particular reason why I have been blocked from nabbler?
If not, can my posting privileges be reinstated?

I think there have been more people with the same problem than just me. By
the way, I have tried the contact form about this in Nabbler many, many
times. No response and no change.

Thank you,

Sami Amiris.

-- 
Sami Amiris
http://www.phosduo.com/sami-amiris/


Pic of score

2021-02-07 Thread Freeman Gilmore
I have a question that I would like to ask, but first can I send pics of
scores with it or do i have to send pics as attachments?

Thank you, ƒg


Pic of score

2021-02-07 Thread Jean Abou Samra
I have a question that I would like to ask, but first can I send pics 
of scores with it or do i have to send pics as attachments?


Thank you, ƒg


Hello,

It is not entirely clear to me how you could send
pictures in a way different from attaching them to
the e-mail. If you mean inline posting, that should
be fine (although I think attachments would be
preferred).

The main factor to take into account would be the
size of the pictures. If they are more than a few tens
of kilobytes, it is wiser to upload them to some kind
of cloud and send a link to them.

Finally, it is best to send code if you have any, rather
than images. However, the latter are welcome if you
are stuck to code something and want to show the
desired output.

Best regards,
Jean



Re: Text Spanner auto expand to end of duration

2021-02-07 Thread Thomas Morley
Am Sa., 6. Feb. 2021 um 20:07 Uhr schrieb Dimitris Marinakis
:
>
> Aha! Found the culprit. As you can see if other staves have different 
> durations (shorter than the span that needs to be covered), the spanner 
> terminates at the first next duration it finds. Could you make the spanner to 
> see only the relevant duration of the context it is applied to? Voice, Staff 
> etc.?
> Apologies for the redundant erroneous mails.
> Dimitris
> %
> \version "2.23.0"
[...]

I don't know any method to do so by amending the current coding.
An engraver could likely work:

\version "2.22.0"

Test_engraver =
#(lambda (context)
  (let* ((rhythmic-events '())
 (bar-line #f)
 (end-spanner #f)
 (trill-spanner #f))
(make-engraver
  (listeners
((rhythmic-event this-event event)
  ;; store moments for all rhythmic events
  ;; NB this will include skip-events
  (set! rhythmic-events
(cons (ly:context-current-moment context) rhythmic-events

  (acknowledgers
((bar-line-interface this-engraver grob source-engraver)
  ;; keep track of BarLine
  (set! bar-line (cons (ly:context-current-moment context) grob)))
((trill-spanner-interface this-engraver grob source-engraver)
  (set! end-spanner #t)
  ;; keep track of TrillSpanner
  (if (ly:grob-property grob 'full-length-to-extent #f)
  (set! trill-spanner grob

  ((stop-translation-timestep this-engraver)
(if (ly:grob? trill-spanner)
(let ((right-bound (ly:spanner-bound trill-spanner RIGHT)))
  (if (and (ly:grob? right-bound) (>= (length rhythmic-events) 2))
  (let* ((curr-moment (ly:context-current-moment context))
 (to-barline?
   (ly:grob-property trill-spanner 'to-barline #f)))
(if (and (equal? (grob::when right-bound)
 (second rhythmic-events))
 end-spanner)
  (begin
;; set right bound of the TrillSpanner to the BarLine
;; if 'to-barline is enabled, otherwise to current
;; PaperColumn
(ly:spanner-set-bound! trill-spanner RIGHT
  (if (and to-barline?
   (equal? (car bar-line) curr-moment))
  (cdr bar-line)
  (ly:context-property
context 'currentMusicalColumn)))
(set! end-spanner #f

  ((finalize this-engraver)
;; house keeping
(set! trill-spanner #f)
(set! rhythmic-events '())
(set! bar-line #f)

instrumentOne = \relative c' {
  \override TrillSpanner.to-barline = ##f
  \override TrillSpanner.full-length-to-extent = ##t
  c4 d\startTrillSpan e f |
  R1 |
  d'2\stopTrillSpan\startTrillSpan c | b a |
  b2  g2 | f2 f2\stopTrillSpan |
  e e e e |
}

instrumentTwo = \relative g' {
  R1 |
  R1 |
  R1 |
  R1 |
  R1 |
  R1 |
  R1 |
}

instrumentThree = \relative g' {
  a4 b c d e f d e c b a d g f e d c b c d e f e d c1
}

\layout {
  \context {
  \Staff
  \consists \Test_engraver
  }
}

<<
  \new Staff \instrumentTwo
  \new Staff \instrumentOne
>>

<<
  \new Staff \instrumentThree
  \new Staff \instrumentOne
>>


You can switch it of by setting
  \override TrillSpanner.full-length-to-extent = ##f

'full-length-to-extent is a property stolen from
'tuplet-bracket-interface. Meaning it is an established grob-property,
but will issue:
programming error: Grob `TrillSpanner' has no interface for
property `full-length-to-extent'
if you compile with the check-internal-types option.

Cheers,
  Harm



Re: Text Spanner auto expand to end of duration

2021-02-07 Thread Dimitris Marinakis
Thanks a lot!
Could this be forwarded to the devs? I think such functions are really
needed in "vanilla" Lilypond. The current behaviour isn't wrong per se but
in most contexts I think the extension of the spanners until the end of the
duration is the standard rule.
They may be able to make something that works even better, that's all I'm
saying. No problems with your solution.

Best,
Dimitris

On Mon, Feb 8, 2021 at 1:01 AM Thomas Morley 
wrote:

> Am Sa., 6. Feb. 2021 um 20:07 Uhr schrieb Dimitris Marinakis
> :
> >
> > Aha! Found the culprit. As you can see if other staves have different
> durations (shorter than the span that needs to be covered), the spanner
> terminates at the first next duration it finds. Could you make the spanner
> to see only the relevant duration of the context it is applied to? Voice,
> Staff etc.?
> > Apologies for the redundant erroneous mails.
> > Dimitris
> > %
> > \version "2.23.0"
> [...]
>
> I don't know any method to do so by amending the current coding.
> An engraver could likely work:
>
> \version "2.22.0"
>
> Test_engraver =
> #(lambda (context)
>   (let* ((rhythmic-events '())
>  (bar-line #f)
>  (end-spanner #f)
>  (trill-spanner #f))
> (make-engraver
>   (listeners
> ((rhythmic-event this-event event)
>   ;; store moments for all rhythmic events
>   ;; NB this will include skip-events
>   (set! rhythmic-events
> (cons (ly:context-current-moment context)
> rhythmic-events
>
>   (acknowledgers
> ((bar-line-interface this-engraver grob source-engraver)
>   ;; keep track of BarLine
>   (set! bar-line (cons (ly:context-current-moment context) grob)))
> ((trill-spanner-interface this-engraver grob source-engraver)
>   (set! end-spanner #t)
>   ;; keep track of TrillSpanner
>   (if (ly:grob-property grob 'full-length-to-extent #f)
>   (set! trill-spanner grob
>
>   ((stop-translation-timestep this-engraver)
> (if (ly:grob? trill-spanner)
> (let ((right-bound (ly:spanner-bound trill-spanner RIGHT)))
>   (if (and (ly:grob? right-bound) (>= (length rhythmic-events)
> 2))
>   (let* ((curr-moment (ly:context-current-moment context))
>  (to-barline?
>(ly:grob-property trill-spanner 'to-barline
> #f)))
> (if (and (equal? (grob::when right-bound)
>  (second rhythmic-events))
>  end-spanner)
>   (begin
> ;; set right bound of the TrillSpanner to the
> BarLine
> ;; if 'to-barline is enabled, otherwise to current
> ;; PaperColumn
> (ly:spanner-set-bound! trill-spanner RIGHT
>   (if (and to-barline?
>(equal? (car bar-line) curr-moment))
>   (cdr bar-line)
>   (ly:context-property
> context 'currentMusicalColumn)))
> (set! end-spanner #f
>
>   ((finalize this-engraver)
> ;; house keeping
> (set! trill-spanner #f)
> (set! rhythmic-events '())
> (set! bar-line #f)
>
> instrumentOne = \relative c' {
>   \override TrillSpanner.to-barline = ##f
>   \override TrillSpanner.full-length-to-extent = ##t
>   c4 d\startTrillSpan e f |
>   R1 |
>   d'2\stopTrillSpan\startTrillSpan c | b a |
>   b2  g2 | f2 f2\stopTrillSpan |
>   e e e e |
> }
>
> instrumentTwo = \relative g' {
>   R1 |
>   R1 |
>   R1 |
>   R1 |
>   R1 |
>   R1 |
>   R1 |
> }
>
> instrumentThree = \relative g' {
>   a4 b c d e f d e c b a d g f e d c b c d e f e d c1
> }
>
> \layout {
>   \context {
>   \Staff
>   \consists \Test_engraver
>   }
> }
>
> <<
>   \new Staff \instrumentTwo
>   \new Staff \instrumentOne
> >>
>
> <<
>   \new Staff \instrumentThree
>   \new Staff \instrumentOne
> >>
>
>
> You can switch it of by setting
>   \override TrillSpanner.full-length-to-extent = ##f
>
> 'full-length-to-extent is a property stolen from
> 'tuplet-bracket-interface. Meaning it is an established grob-property,
> but will issue:
> programming error: Grob `TrillSpanner' has no interface for
> property `full-length-to-extent'
> if you compile with the check-internal-types option.
>
> Cheers,
>   Harm
>


Re: Text Spanner auto expand to end of duration

2021-02-07 Thread Jean Abou Samra

   ((finalize this-engraver)
 ;; house keeping
 (set! trill-spanner #f)
 (set! rhythmic-events '())
 (set! bar-line #f)



Hi Harm,

Is there a reason to reset variables in 'finalize'
methods like this?

I've done without so far and never had any
problem; engravers in scm/scheme-engravers.scm
only do it when you are their author ;-)

Just curious.

Thanks,
Jean



Re: Guitar tab question

2021-02-07 Thread Carl Sorensen


On 2/7/21, 10:17 AM, "lilypond-user on behalf of Thomas Morley" 
 wrote:

Am So., 7. Feb. 2021 um 17:23 Uhr schrieb John Ward :
>
> I'm new to music notation software and I have a question. Does Lily Pond 
include the feature that allows you to write in guitar tab, convert that guitar 
tab automatically to standard notation and then cut and paste that notation to 
a piano score?
> Sibelius and Muse score both have this feature.
>
> Thanks,
>
> John
>

In LilyPond you would define a variable and call it where you want, p.e.:

\version "2.23.0"

mus = \relative a {
  a4 b c d e f g a a1
}

<<
  \new TabStaff \mus

  \new RhythmicStaff \mus

  \new ChordNames \chordmode { \mus }

  \new Staff { \clef "G_8" \mus }

  \new NoteNames \mus

  \new PianoStaff \autoChange \mus
>>

I'm not sure what you mean with "the feature that allows you to write
in guitar tab".
Tabs needs to be entered in the so called "notemode" as demonstrated above.
To write "put a finger on string two at first fret" (to get a c') is

c'\2 will get a finger on string 2 at the appropriate fret.  And if you want to 
say which finger, you can add that as well:
c'\2-1

I guess you are saying there is no way to input notes as tablature, without 
knowing the pitch of the note.  That is true.

I just wanted to clear that up, as your answer confused me for a while.

Thanks,

Carl
 



Re: Text Spanner auto expand to end of duration

2021-02-07 Thread Thomas Morley
Am Mo., 8. Feb. 2021 um 00:29 Uhr schrieb Jean Abou Samra :
>
>   ((finalize this-engraver)
> ;; house keeping
> (set! trill-spanner #f)
> (set! rhythmic-events '())
> (set! bar-line #f)
>
>
> Hi Harm,
>
> Is there a reason to reset variables in 'finalize'
> methods like this?
>
> I've done without so far and never had any
> problem; engravers in scm/scheme-engravers.scm
> only do it when you are their author ;-)
>
> Just curious.
>
> Thanks,
> Jean

Well, I seem to remember that there was a problem, if a
custom-engraver was consisted in various files all compiled in one go
like
lilypond file-1.ly file-2.ly.
Some bleed over, iirc. I didn't test recently, though. It doesn't hurt
to reset the variables, imho.

Cheers,
  Harm