Re: Can a \bookpart be a variable?

2022-09-23 Thread Jean Abou Samra




Le 23/09/2022 à 08:17, Brent Annable a écrit :

Hi all,

I've been typesetting a bunch of hymns for inclusion in a larger 
publication, and I now have about 100 separate Lilypond files that I 
need to collate into a single master file. It seems easiest to me to 
turn each individual file into a \bookpart, set the bookpart as a 
variable, then \include the file name in a separate master file and 
call on the variable there.


But when I do that and try to compile the master, I just get a bunch 
of error messages in the original file (I'm using Frescobaldi, and all 
of the variables in the original file are highlighted in red). My 
question is: is this possible? Should it work if I turn the \bookpart 
into a variable and call on it elsewhere, and am I just making a silly 
programming error? Or should I try another method?


If it should be possible, I'm happy to share some files to illustrate.




It can be done, the syntax is just slightly strange:

\version "2.22.2"

mybookpart = \bookpart { { c' } }

\book {
  % Not
  % \mybookpart
  % but
  \bookpart { \mybookpart }
}

Best,
Jean





Re: Alphabetised table of contents?

2022-09-23 Thread Valentin Petzel
Hej Brent!

Creating multiple indices is not a big thing. The problem is that the code for 
the toc has to be executed at initialisation (see toc-init.ly), so we cannot 
simply add more kinds of toc. But we can easily extend this toc code to allow 
for filtering to specific entries.

The appended file makes use of the optional label toc items might have to 
filter 
the toc.
You might want to modify the formatting a bit though.

Also one thing to keep in mind: Ordering is done lexicographically, so for 
example "Z" would come before "a". You might want to use a slightly more 
natural ordering that handles things like cases or typography before the first 
word-letter (e.g. "Zadok the priest" would come before "”Alas!“, he spoke, 
”this does not quite cut it!“)

Cheers,
Valentin

Am Freitag, 23. September 2022, 08:11:20 CEST schrieb Brent Annable:
> Thanks for all the tips everyone! I will look into these snippets.
> 
> I do actually need to create multiple indices (alphabetical by first line
> and by tune name0, so maybe my dream won't be possible for the time being,
> but it's good to know this functionality exists.
> 
> Brent.
> 
> On Thu, 22 Sept 2022 at 04:49, Jean Abou Samra  wrote:
> > Le 21/09/2022 à 20:39, Valentin Petzel a écrit :
> > > Hello Jean,
> > > 
> > > at least for me this code fails to change the order of the toc. The
> > 
> > reason for
> > 
> > > this is that toc-markup does not in fact contain the markup, but the
> > 
> > symbol
> > 
> > > under which the formatting markup is saved in layout.
> > > 
> > > So I suppose you rather want to use the text property:
> > > 
> > > (sorted-toc-alist
> > > 
> > > (sort toc-alist
> > > 
> > >   ;; Could use comparator-from-key in 2.23
> > >   (lambda (item1 item2)
> > >   
> > > (let ((mkup1 (assoc-get 'text (cdr item1)))
> > > 
> > >   (mkup2 (assoc-get 'text (cdr item2
> > >
> > >(string > >(markup->string mkup1)
> > >(markup->string mkup2))
> > 
> > Whoops, yes. Not sure how I didn't see that they weren't sorted.
> > Maybe I did a test and sent the wrong version? Weird. Anyway,
> > thanks for the correction.

\version "2.22.2"

#(define (symbol-or-false-or-procedure? x) (or (symbol? x) (not x) (procedure? x)))

% An alist for saving predefined comparator functions. Could just define them and pass a reference, but this way might be a bit cleaner.
#(define orderings
   (list
(cons 'lex-by-text
  (lambda (item1 item2)
 (let ((mkup1 (assoc-get 'text (cdr item1)))
   (mkup2 (assoc-get 'text (cdr item2
(stringstring mkup1)
(markup->string mkup2)))

%% Copied from LilyPond's definition and modified
% @param filterfn can be
%	 A) A symbol (filter on label == filterfn)
%	 B) A procedure (filter on (filterfn tocitem))
%	 C) #f (Do not filter)
% @param cmp can be
%	 A) A symbol (use predefined procedure from orderings alist)
%	 B) A procedure (sort using (cmp tocitem1 tocitem2))
%	 C) #f (Do not sort)
#(define-markup-list-command (filtered-ordered-table-of-contents layout props filterfn cmp)
   (symbol-or-false-or-procedure? symbol-or-false-or-procedure?)
   #:properties ((baseline-skip))
   (if (symbol? cmp)
   (set! cmp (assoc-get cmp orderings cmp)))
   (if (symbol? cmp) (ly:error "Predefined ordering ~a does not exist" cmp))
   (let* ((titleMarkup (ly:output-def-lookup layout 'tocTitleMarkup))
  (indentMarkup (ly:output-def-lookup layout 'tocIndentMarkup))
  (toplevelFormatter (ly:output-def-lookup layout 'tocFormatMarkup))
  (toc-alist (toc-items))
  (filtered-toc-alist
   (if filterfn
   (if (symbol? filterfn)
   (filter
(lambda (item) (eq? filterfn (assoc-get 'name (cdr item
toc-alist)
   (filter filterfn toc-alist))
   toc-alist))
  (sorted-toc-alist
   (if cmp
   (sort filtered-toc-alist cmp)
   filtered-toc-alist)))

 (ly:output-def-set-variable! layout 'label-alist-table
  (append (ly:output-def-lookup layout 'label-alist-table)
  toc-alist))
 (cons (interpret-markup layout props titleMarkup)
   (space-lines baseline-skip
(map (lambda (toc-item)
   (let* ((label (car toc-item))
  (alist (cdr toc-item))
  (toc-markup (assoc-get 'toc-markup alist))
  (text (assoc-get 'text alist))
  (level (assoc-get 'level alist)))
 (interpret-markup

midi de percussion dans une Staff

2022-09-23 Thread Martial R
Bonjour

je souhaiterai avoir un handclap au lieu d'un woodblock
je n'arrive pas à mettre à la suite  d' un Staff un DrumStaff

%
\version "2.22.2" %ou "2.23.12"

\score {
\new Staff {
 \set Staff.midiInstrument = "acoustic guitar (nylon)"
 \new Voice \relative { << { r8 g'4 g g g8 } \\ { e1  } >>
   \override NoteHead.style = #'slash
  \set Staff.midiInstrument = "woodblock"
  % hanclap à la place de woodblock
a8->  a a a->  a a a-> a  }
}

\layout { }
\midi { \tempo 4=102 }
}
%

Merci d'avance

[image: image.png]



-- 
Martial Rameaux


Re: midi de percussion dans une Staff

2022-09-23 Thread Jean Abou Samra

Hi Martial,

I suppose you meant to send this to lilypond-user-fr, not lilypond-user, 
right?


Best,
Jean





Re: midi de percussion dans une Staff

2022-09-23 Thread Martial R
Yes, sorry.

Le ven. 23 sept. 2022 à 11:40, Jean Abou Samra  a
écrit :

> Hi Martial,
>
> I suppose you meant to send this to lilypond-user-fr, not lilypond-user,
> right?
>
> Best,
> Jean
>
>
>


Re: midi de percussion dans une Staff

2022-09-23 Thread Martial R
Je m'explique mal ...
C'est dans la sortie midi que je souhaite avoir un handclap et non un
woodblock
or le handclap ne sort qu'en DrumStaff ou bien je ne trouve pas le biais.


Merci d'avance


-- 
Martial Rameaux


Re: pitch-class sets in lilypond

2022-09-23 Thread Stefan Thomas
Dear community,
this is so far my module for working with pitch-class sets.
If You want to try it, You should save the 2 files in the same folder.
I've added a snippet in Frescobaldi, which  works fine (at least for me):

-*- python;

import sys

sys.path.append('/yourfolder/stefanspcs')

import stefanspcs

text = stefanspcs.get_prime_from_lily(text)

text = stefanspcs.get_lilyfrom_prime(text)

print(text)

You can select some music (pitches only, no durations, and so on) and You
will see the prime-form when You run Your the above qwoted

In this way You can do some other things with this module, if You're
interested.

Best,

Stefan

Am Di., 20. Sept. 2022 um 21:31 Uhr schrieb Jean Abou Samra <
j...@abou-samra.fr>:

>
>
> Le 20/09/2022 à 16:27, Lukas-Fabian Moser a écrit :
> >
> > Hi Stefan,
> >
> > Am 20.09.22 um 13:00 schrieb Stefan Thomas:
> >> Dear community,
> >> sorry, it's a bit an off topic: If You are not interested in
> >> pitch-class set theory, You don't have to read the following.
> >> I've worked on a python module dealing with pitch-class set theory as
> >> I've read in "The structure of atonal music" by Allen Forte.
> >> I know that there already exists some modules like that but I want to
> >> integrate it in lilypond.
> >> I'm still working on this module, but at the  moment I can do:
> >>
> >>   * Getting the normal form and prime form of a pcs.
> >>   * Transposing and inverting a pcs
> >>   * Finding subsets of a pcs given in primeform.
> >>
> >> I'm working on:
> >>
> >>   * Finding different kinds of similarity of pcs.
> >>   * Getting subcomplexes k and kh of a pcs.
> >>   * Finding primeform and so on, when pitches in lilypond-style are
> >> given.
> >>   * Getting pitches in lilypond-style when pitches in midinote-nums
> >> or as pcs are given.
> >>
> >> Let me know it if You are interested. Maybee it's only something of
> >> interest for nerdy persons like me, but maybee for others too.
> >
> > I don't know if this is of use to you, but I created a bunch of
> > LilyPond routines for dealing with PC sets (like in Forte, but also
> > with a finer equivalence relation not identifying a set with its
> > inverse) last year. I attach it unchanged, as I don't have time to
> > clean it up at the moment; you'll probably want to uncomment some of
> > the routines at the end to see what the functions do.
> >
> > I'm curious: You write that you are working on a Python module; how
> > does this integrate in LilyPond?
> >
>
>
> What does the include file dodeka.ily contain?
>
toene_notnums = { }
toene_notnums["a,,,"]=21
toene_notnums["bes,,,"]=22
toene_notnums["ais,,,"]=22
toene_notnums["b,,"]=23
toene_notnums["bis,,"]=24
toene_notnums["his,,"]=24
toene_notnums["c,,"]=24
toene_notnums["des,,"]=25
toene_notnums["cis,,"]=25
toene_notnums["d,,"]=26
toene_notnums["es,,"]=27
toene_notnums["dis,,"]=27
toene_notnums["e,,"]=28
toene_notnums["eis,,"]=29
toene_notnums["f,,"]=29
toene_notnums["ges,,"]=30
toene_notnums["fis,,"]=30
toene_notnums["g,,"]=31
toene_notnums["as,,"]=32
toene_notnums["gis,,"]=32
toene_notnums["a,,"]=33
toene_notnums["bes,,"]=34
toene_notnums["ais,,"]=34
toene_notnums["b,,"]=35
toene_notnums["bis,,"]=36
toene_notnums["his,,"]=36
toene_notnums["c,"]=36
toene_notnums["des,"]=37
toene_notnums["cis,"]=37
toene_notnums["d,"]=38
toene_notnums["es,"]=39
toene_notnums["dis,"]=39
toene_notnums["e,"]=40
toene_notnums["eis,"]=41
toene_notnums["f,"]=41
toene_notnums["ges,"]=42
toene_notnums["fis,"]=42
toene_notnums["g,"]=43
toene_notnums["as,"]=44
toene_notnums["gis,"]=44
toene_notnums["a,"]=45
toene_notnums["bes,"]=46
toene_notnums["ais,"]=46
toene_notnums["b,"]=47
toene_notnums["bis,"]=48
toene_notnums["his,"]=48
toene_notnums["c"]=48
toene_notnums["des"]=49
toene_notnums["cis"]=49
toene_notnums["d"]=50
toene_notnums["es"]=51
toene_notnums["dis"]=51
toene_notnums["e"]=52
toene_notnums["eis"]=53
toene_notnums["f"]=53
toene_notnums["ges"]=54
toene_notnums["fis"]=54
toene_notnums["g"]=55
toene_notnums["as"]=56
toene_notnums["gis"]=56
toene_notnums["a"]=57
toene_notnums["bes"]=58
toene_notnums["ais"]=58
toene_notnums["b"]=59
toene_notnums["bis"]=60
toene_notnums["his"]=60
toene_notnums["c'"]=60
toene_notnums["des'"]=61
toene_notnums["cis'"]=61
toene_notnums["d'"]=62
toene_notnums["es'"]=63
toene_notnums["dis'"]=63
toene_notnums["e'"]=64
toene_notnums["eis'"]=65
toene_notnums["f'"]=65
toene_notnums["ges'"]=66
toene_notnums["fis'"]=66
toene_notnums["g'"]=67
toene_notnums["as'"]=68
toene_notnums["gis'"]=68
toene_notnums["a'"]=69
toene_notnums["bes'"]=70
toene_notnums["ais'"]=70
toene_notnums["b'"]=71
toene_notnums["bis'"]=72
toene_notnums["his'"]=72
toene_notnums["c''"]=72
toene_notnums["des''"]=73
toene_notnums["cis''"]=73
toene_notnums["d''"]=74
toene_notnums["es''"]=75
toene_notnums["dis''"]=75
toene_notnums["e''"]=76
toene_notnums["eis''"]=77
toene_notnums["f''"]=77
toene_notnums["ges''"]=78
toene_notnums["fis''"]=78
toene_notnums["g''"]=79
toene_notnums["as''"]=80
toene_notnums["gis''

How to create a double dashed bar across the PianoStaff in the middle of a measure?

2022-09-23 Thread Volodymyr Prokopyuk
Hello,

How to create a double dashed bar across the PianoStaff in the middle of a
measure to indicate Fine?

I can successfully create the following bars across the PianoStaff

   - Double solid bar with \bar "||"
   - Single dashed bar with \bar "!"

I've tried with no success \bar "!!" and some variations of \defineBarLine
to create a double dashed bar across the PianoStaff in the middle of a
measure to indicate Fine. Could you, please, help me?

I'm using lilypond v2.23.11.

Thank you very much in advance! Vlad


Re: How to create a double dashed bar across the PianoStaff in the middle of a measure?

2022-09-23 Thread Hans Aikema


> On 23 Sep 2022, at 19:30, Volodymyr Prokopyuk  
> wrote:
> 
> Hello,
> 
> How to create a double dashed bar across the PianoStaff in the middle of a 
> measure to indicate Fine?
> 
> I can successfully create the following bars across the PianoStaff
> 
> Double solid bar with \bar "||"
> Single dashed bar with \bar "!"
> I've tried with no success \bar "!!" and some variations of \defineBarLine to 
> create a double dashed bar across the PianoStaff in the middle of a measure 
> to indicate Fine. Could you, please, help me?
> 
> I'm using lilypond v2.23.11.
> 
> Thank you very much in advance! Vlad
> 
If I understand it correctly 

\defineBarLine "!!" #'("!!" "!!" "!!")

\new StaffGroup <<
  \new Staff \relative c'' {
c1
c2 \bar "!!" c2
c1
  }
  \new Staff \relative c'' {
c1
c1
c1
  }
>>

Is what you’re looking for?



Re: How to create a double dashed bar across the PianoStaff in the middle of a measure?

2022-09-23 Thread Francesco Napoleoni
In data venerdì 23 settembre 2022 19:30:05 CEST, Volodymyr Prokopyuk ha 
scritto:
> Hello,
> 
> How to create a double dashed bar across the PianoStaff in the middle of a
> measure to indicate Fine?
> 
> I can successfully create the following bars across the PianoStaff
> 
>- Double solid bar with \bar "||"
>- Single dashed bar with \bar "!"
> 
> I've tried with no success \bar "!!" and some variations of \defineBarLine
> to create a double dashed bar across the PianoStaff in the middle of a
> measure to indicate Fine. Could you, please, help me?
> 
> I'm using lilypond v2.23.11.
> 
> Thank you very much in advance! Vlad

Hi

Not sure if this is what you are after, anyway the following code prints a 
dashed double bar line in the middle of a measure:

\version "2.23.5"

\defineBarLine "!!" #'("!!" "!!" "!!")

\new PianoStaff <<
  \new Staff \relative c' {
c2 \bar "!!" c |
c1 |
  }

  \new Staff \relative c {
\clef bass
c2 c |
c1 |
  }
>>

cheers
Francesco Napoleoni







Re: pitch-class sets in lilypond

2022-09-23 Thread Jean Abou Samra

Hi,

Pardon me for pointing out an English mistake, but it's an amusing one:


Le 23/09/2022 à 19:47, Stefan Thomas a écrit :
You can select some music (pitches only, no durations, and so on) and 
You will see the prime-form when You run Your the above qwoted




It's "quoted", not "qwoted" :-)  I suspect that you were influenced by
the recent post
https://lists.gnu.org/archive/html/lilypond-user/2022-09/msg00237.html

It's not important strictly speaking for \addQuote and \quoteDuring,
but I prefer avoiding the name "quote", because it's also the name of
one of Scheme's most fundamental builtins."kwote" is an intentional
misspelling for "quote".

Random fun facts:  I didn't invent it. In Lisp/Scheme, there is a tradition
of calling "kwote" a cousin of "quote" that is a function. It can be defined
as

(define (kwote x)
  `',x)

or

(define (kwote x)
  (list 'quote x))

I've heard "kwote" pronounced as "kay-wote" to distinguish it from
"quote".

Jean