Automatically numbering "instrument name"?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Automatically numbering "instrument name"?

Sam Bivens
As I finish up a sight-singing course packet, I'm wondering if it's possible for LilyPond to automatically number the individual scores from beginning to end.

Throughout the document, I have six different types of score contexts, shown in mwe.ly.

The perfect solution would be a fix where LilyPond automatically creates a `\with { instrumentName = "1. " }`, where the "1." here becomes dynamic and adjusts depending on the ordering of the score samples within the document.

Perhaps there is only a solution where we can insert a variable that will increase by one at every occurrence. If so, this is sufficient; I can write my own script to insert all necessary `instrumentName = "var"` entries.

Thanks,

Sam

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user

mwe.ly (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Automatically numbering "instrument name"?

Manuela
Do you mean something like this?

#(define score-number 0) %% insert in first score

#(set! score-number (1+ score-number))

 \new PianoStaff \with {
    instrumentName = \markup {
 #(number->string score-number) "."
    }
  }
\relative c'' { c }


2017-08-08 23:33 GMT+02:00 Sam Bivens <[hidden email]>:
As I finish up a sight-singing course packet, I'm wondering if it's possible for LilyPond to automatically number the individual scores from beginning to end.

Throughout the document, I have six different types of score contexts, shown in mwe.ly.

The perfect solution would be a fix where LilyPond automatically creates a `\with { instrumentName = "1. " }`, where the "1." here becomes dynamic and adjusts depending on the ordering of the score samples within the document.

Perhaps there is only a solution where we can insert a variable that will increase by one at every occurrence. If so, this is sufficient; I can write my own script to insert all necessary `instrumentName = "var"` entries.

Thanks,

Sam

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user



_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Automatically numbering "instrument name"?

Malte Meyn-3


Am 09.08.2017 um 06:34 schrieb Manuela Gößnitzer:

> Do you mean something like this?
>
> #(define score-number 0) %% insert in first score
>
> #(set! score-number (1+ score-number))
>
>   \new PianoStaff \with {
>      instrumentName = \markup {
>   #(number->string score-number) "."
>      }
>    }
> \relative c'' { c }

You would have to do this set! before every score. Try the following
instead:

\version "2.19.64"

#(define sn 0)

#(define (score-number)
    (set! sn (1+ sn))
    (string-append (number->string sn) "."))

\new Staff \with {
   instrumentName = #(score-number)
} c'
\new Staff \with {
   instrumentName = #(score-number)
} c'
\new Staff \with {
   instrumentName = #(score-number)
} c'
\new Staff \with {
   instrumentName = #(score-number)
} c'
\new Staff \with {
   instrumentName = #(score-number)
} c'

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Automatically numbering "instrument name"?

Sam Bivens
Hi Manuel and Malte,

Thanks so much for the help; this is exactly what I was looking for!

Sam

On Wed, Aug 9, 2017 at 4:18 AM, Malte Meyn <[hidden email]> wrote:


Am 09.08.2017 um 06:34 schrieb Manuela Gößnitzer:
Do you mean something like this?

#(define score-number 0) %% insert in first score

#(set! score-number (1+ score-number))

  \new PianoStaff \with {
     instrumentName = \markup {
  #(number->string score-number) "."
     }
   }
\relative c'' { c }

You would have to do this set! before every score. Try the following instead:

\version "2.19.64"

#(define sn 0)

#(define (score-number)
   (set! sn (1+ sn))
   (string-append (number->string sn) "."))

\new Staff \with {
  instrumentName = #(score-number)
} c'
\new Staff \with {
  instrumentName = #(score-number)
} c'
\new Staff \with {
  instrumentName = #(score-number)
} c'
\new Staff \with {
  instrumentName = #(score-number)
} c'
\new Staff \with {
  instrumentName = #(score-number)
} c'


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user



--
Sam Bivens
Music Theory Faculty | Cleveland Institute of Music
Ph.D. Candidate | Eastman School of Music
Co-Editor, Intégral


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Automatically numbering "instrument name"?

Manuela
 Hi Sam,

thank you for your feddback. My name is Manuela, I am female :-)


2017-08-09 21:00 GMT+02:00 Sam Bivens <[hidden email]>:
Hi Manuel and Malte,

Thanks so much for the help; this is exactly what I was looking for!

Sam

On Wed, Aug 9, 2017 at 4:18 AM, Malte Meyn <[hidden email]> wrote:


Am 09.08.2017 um 06:34 schrieb Manuela Gößnitzer:
Do you mean something like this?

#(define score-number 0) %% insert in first score

#(set! score-number (1+ score-number))

  \new PianoStaff \with {
     instrumentName = \markup {
  #(number->string score-number) "."
     }
   }
\relative c'' { c }

You would have to do this set! before every score. Try the following instead:

\version "2.19.64"

#(define sn 0)

#(define (score-number)
   (set! sn (1+ sn))
   (string-append (number->string sn) "."))

\new Staff \with {
  instrumentName = #(score-number)
} c'
\new Staff \with {
  instrumentName = #(score-number)
} c'
\new Staff \with {
  instrumentName = #(score-number)
} c'
\new Staff \with {
  instrumentName = #(score-number)
} c'
\new Staff \with {
  instrumentName = #(score-number)
} c'


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user



--
Sam Bivens
Music Theory Faculty | Cleveland Institute of Music
Ph.D. Candidate | Eastman School of Music
Co-Editor, Intégral


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user



_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Loading...