Need help with usage of breve

2022-12-23 Thread Dave Seidel
Hi all. I am building a score with a lot of tied whole notes, and I'd like
to make it more concise by using breves. However, I am clearly not
understanding how to use them properly.

Example using ties:

\version "2.22.2"
\score {
\new Staff \relative {
\clef treble
\new Voice \relative {
\time 6/1 \partial 1 f'1 ~
f1 fis1 ~ fis1 a1 ~ a1 b1
}
}
}

Which produces the expected result:
[image: lilypad-test-1.png]

Here's a version using breves according to my understanding based on the
docs (
http://lilypond.org/doc/v2.24/Documentation/notation/writing-rhythms#durations
):

\version "2.22.2"
\score {
\new Staff \relative {
\clef treble
\new Voice \relative {
\time 6/1 \partial 1 f'1 ~
f1 fis1\breve a1\breve b1
}
}
}

Which produces an unexpected result (repeated notes, barline in wrong
place):
[image: lilypad-test-2.png]
Please tell me what I'm doing wrong.

Thanks,
Dave


Re: trying to define microtonal note names and accidentals

2020-10-22 Thread Dave Seidel
I'm hoping to dip into these waters eventually. I tried using the HEJI
fonts with kind assistance from Konstantin Heuer (who has been working on
updating microlily), but without much luck so far.

I have developed one microtonal score so far (mostly I write electronic
music for which scores are not needed), and since it's a quite
minimal piece with only seven pitches, I opted to annotate the score with
offsets in cents on the first appearance of each pitch, and added a
performance note section to document the associations between the pitch
offsets and the actual ratios I intended.

I would like to use microtonal accidentals at some point, but the fact that
there are competing styles (Helmholtz-Ellis, Johnston, Sagittal, ...) is
concerning since it's hard enough to find performers who will even
recognize the various notations and interpret them correctly. So using
cents offsets, in this particular case, seemed like a more "objective" way
to indicate the pitches. But of course this is a matter of taste and
preference.

- Dave

On Thu, Oct 22, 2020 at 9:23 AM Hans Åberg  wrote:

>
> > On 21 Oct 2020, at 12:43, Stefan Thomas 
> wrote:
> >
> > I'm trying to define microtonal note names and accidentals with the
> HE-font.
>
> I made such for Helmholtz–Ellis notation in E53 and E72, using the Bravura
> font.
>
>
>
>


Re: Scheme expressions on lilypond command line (-e)

2020-10-20 Thread Dave Seidel
This is excellent, Aaron, thanks very much. Learning by example suits me
well, and I'm enjoying getting into Scheme. I use Python + Java all day
long on the job (in fact used Python to generate all of the music parts of
the score I'm working on -- it's originally a Csound piece that was written
using Python in the first place), and it's good for the brain to get
stretched into a different paradigm.

- Dave

On Mon, Oct 19, 2020 at 11:26 PM Aaron Hill 
wrote:

> On 2020-10-19 7:51 pm, Dave Seidel wrote:
> > More succinct:
> >
> > #(begin
> >   (use-modules (guile-user))
> >
> >   (if (not(defined? 'part))
> > (define partName "")
> > (define partName (string-append "S" (number->string part)))
> >   )
> > )
>
> To be even more succinct, observe the following:
>
> 
> Avoid negated predicates by swapping the consequent and alternate.
> 
> (if (defined? 'part)
>  (define partName (string-append "S" (number->string part)))
>  (define partName ""))
> 
>
> 
> Extract common logic from consequent and alternate.
> 
> (define partName
>(if (defined? 'part)
>(string-append "S" (number->string part))
>""))
> 
>
> 
> Use formatted output instead of manual string conversion/concatenation.
> 
> (define partName
>(if (defined? 'part)
>(format #f "S~d" part)
>""))
> 
>
>
> -- Aaron Hill
>
>


Re: Scheme expressions on lilypond command line (-e)

2020-10-19 Thread Dave Seidel
More succinct:

#(begin
  (use-modules (guile-user))

  (if (not(defined? 'part))
(define partName "")
(define partName (string-append "S" (number->string part)))
  )
)

though the warning still prints, but that's not a big deal for me.

On Mon, Oct 19, 2020 at 10:23 PM Dave Seidel  wrote:

> Interesting. I don't understand the '@' syntax -- been trying to look it
> up but so far to no avail.
>
> Here's what I ended up with:
>
> #(begin
>   (use-modules (guile-user))
>
>   (if (not(symbol? 'part))
> (define part 0)
>   )
>
>   (if (= part 0)
> (define partName "")
> (define partName (string-append "S" (number->string part)))
>   )
> )
>
> which gives me a default value for "part" if not defined on the command
> line. The "partName" variable is used later: if non-null, the script will
> print parts instead of a full score, thus
>
> lilypond -o Hexany_Permutations hexany_permutations.ly
> lilypond -e "(define part 1)" -o Hexany_Permutations_S1
> hexany_permutations.ly
> lilypond -e "(define part 2)" -o Hexany_Permutations_S2
> hexany_permutations.ly
> lilypond -e "(define part 3)" -o Hexany_Permutations_S3
> hexany_permutations.ly
> lilypond -e "(define part 4)" -o Hexany_Permutations_S4
> hexany_permutations.ly
> lilypond -e "(define part 5)" -o Hexany_Permutations_S5
> hexany_permutations.ly
> lilypond -e "(define part 6)" -o Hexany_Permutations_S6
> hexany_permutations.ly
>
> which yields a PDF for the full score and a separate PDF for each part
> (where the instruments are designated as S1 through S6). I guess I could
> probably do it all in a single invocation, but I haven't gotten that far
> yet -- only been using Lilypond for about a week now.
>
> - Dave
>
> On Mon, Oct 19, 2020 at 6:22 PM Aaron Hill 
> wrote:
>
>> On 2020-10-19 2:45 pm, Jean Abou Samra wrote:
>> > You can ignore the warning that shows up
>> > (https://gitlab.com/lilypond/lilypond/-/issues/3613).
>>
>> You can avoid the warning by using the @ syntax:
>>
>>  eval-scope.ly 
>> \version "2.20.0"
>> #(format #t "\nvalue = ~s"
>>(false-if-exception (@ (guile-user) value)))
>> 
>>
>> 
>> > lilypond eval-scope.ly
>> GNU LilyPond 2.20.0
>> Processing `eval-scope.ly'
>> Parsing...
>> value = #f
>> Success: compilation successfully completed
>>
>> > lilypond -e "(define-public value 123)" eval-scope.ly
>> GNU LilyPond 2.20.0
>> Processing `eval-scope.ly'
>> Parsing...
>> value = 123
>> Success: compilation successfully completed
>> 
>>
>>
>> -- Aaron Hill
>>
>>


Re: Scheme expressions on lilypond command line (-e)

2020-10-19 Thread Dave Seidel
Interesting. I don't understand the '@' syntax -- been trying to look it up
but so far to no avail.

Here's what I ended up with:

#(begin
  (use-modules (guile-user))

  (if (not(symbol? 'part))
(define part 0)
  )

  (if (= part 0)
(define partName "")
(define partName (string-append "S" (number->string part)))
  )
)

which gives me a default value for "part" if not defined on the command
line. The "partName" variable is used later: if non-null, the script will
print parts instead of a full score, thus

lilypond -o Hexany_Permutations hexany_permutations.ly
lilypond -e "(define part 1)" -o Hexany_Permutations_S1
hexany_permutations.ly
lilypond -e "(define part 2)" -o Hexany_Permutations_S2
hexany_permutations.ly
lilypond -e "(define part 3)" -o Hexany_Permutations_S3
hexany_permutations.ly
lilypond -e "(define part 4)" -o Hexany_Permutations_S4
hexany_permutations.ly
lilypond -e "(define part 5)" -o Hexany_Permutations_S5
hexany_permutations.ly
lilypond -e "(define part 6)" -o Hexany_Permutations_S6
hexany_permutations.ly

which yields a PDF for the full score and a separate PDF for each part
(where the instruments are designated as S1 through S6). I guess I could
probably do it all in a single invocation, but I haven't gotten that far
yet -- only been using Lilypond for about a week now.

- Dave

On Mon, Oct 19, 2020 at 6:22 PM Aaron Hill  wrote:

> On 2020-10-19 2:45 pm, Jean Abou Samra wrote:
> > You can ignore the warning that shows up
> > (https://gitlab.com/lilypond/lilypond/-/issues/3613).
>
> You can avoid the warning by using the @ syntax:
>
>  eval-scope.ly 
> \version "2.20.0"
> #(format #t "\nvalue = ~s"
>(false-if-exception (@ (guile-user) value)))
> 
>
> 
> > lilypond eval-scope.ly
> GNU LilyPond 2.20.0
> Processing `eval-scope.ly'
> Parsing...
> value = #f
> Success: compilation successfully completed
>
> > lilypond -e "(define-public value 123)" eval-scope.ly
> GNU LilyPond 2.20.0
> Processing `eval-scope.ly'
> Parsing...
> value = 123
> Success: compilation successfully completed
> 
>
>
> -- Aaron Hill
>
>


Re: Scheme expressions on lilypond command line (-e)

2020-10-19 Thread Dave Seidel
Thanks Jean! I need to read more carefully!

On Mon, Oct 19, 2020 at 5:45 PM Jean Abou Samra  wrote:

>
> Le 19/10/2020 à 23:14, Dave Seidel a écrit :
>
> Hi all,
>
> I am trying to define a variable on the command line that I can use within
> the .ly file. I've tried both
>
> -e "(define-public part 1)"
>
> and
>
> -e "(define part 1)"
>
>
> In the .ly file, I have a Scheme expression
>
> #(if (= part 0)
>   (define partName "")
>   (define partName (string-append "S" part))
> )
>
>
> In either case, I get the error
>
> GUILE signaled an error for the expression beginning here
> #
>  (if (= part 0)
> Unbound variable: part
>
>
> I guess I'm either defining the variable incorrectly, or dereferencing it
> incorrectly within the script. Can someone help?
>
> Thanks,
>
> Dave
>
>
> Hi,
>
> Have a look at
>
>
> lilypond.org/doc/v2.21/Documentation/usage/command_002dline-usage#basic-command-line-options-for-lilypond.html
>
> You need
>
> #(use-modules (guile-user))
>
> at the top of your LilyPond source.
>
> You can ignore the warning that shows up 
> (https://gitlab.com/lilypond/lilypond/-/issues/3613).
>
> Best,
> Jean
>
>


Scheme expressions on lilypond command line (-e)

2020-10-19 Thread Dave Seidel
Hi all,

I am trying to define a variable on the command line that I can use within
the .ly file. I've tried both

-e "(define-public part 1)"

and

-e "(define part 1)"


In the .ly file, I have a Scheme expression

#(if (= part 0)
  (define partName "")
  (define partName (string-append "S" part))
)


In either case, I get the error

GUILE signaled an error for the expression beginning here
#
 (if (= part 0)
Unbound variable: part


I guess I'm either defining the variable incorrectly, or dereferencing it
incorrectly within the script. Can someone help?

Thanks,
Dave


Re: newbie: help with Scheme functions

2020-10-18 Thread Dave Seidel
Thanks, Aaron.

On Sun, Oct 18, 2020 at 4:46 PM Aaron Hill  wrote:

> On 2020-10-18 1:38 pm, Dave Seidel wrote:
> > Very cool, thanks! I'm curious -- could aBook and aBookPart have been
> > written as a lambda, or is it cleaner to use a void function?
>
> (Re-adding the mailing list on the thread for visibility.)
>
> To get the benefits of LilyPond's Scheme functions, you would need to
> use one of the define-*-function family.  Since it is our intention here
> not to return any value, we use the void function.
>
> If you do not need any parameters, you can certainly invoke procedures
> like print-book-with-defaults or ly:book-add-bookpart! without wrapping
> them in a function.  Though, without parameterization, I would wonder
> why you could not just use \book or \bookpart directly.
>
>
> -- Aaron Hill
>


Re: newbie: help with Scheme functions

2020-10-18 Thread Dave Seidel
Having articulated the question, I figured out that apparently one can't
return a \bookpart from a Scheme function, but it's ok to return a \score,
so I am restructuring my code.

On Sun, Oct 18, 2020 at 10:28 AM Dave Seidel  wrote:

> Hi,
>
> I have a multi-section piece, with a master .ly file that uses \include
> for each of the sections of the piece. Each included file more or less
> follows the pattern of the string quartet template that ships with
> Lilypond: a series of macros, one per voice, followed by a \bookpart
> section that builds a StaffGroup, with one Staff per voice. This bookpart
> block is nearly identical in all the included files, with the exception of
> a title string used for "piece" property in in a \header section and also
> also as a \tocItem.
>
> This all works quite well, and I have a nice score with everything. Now
> I'd like to be able to produce parts, and my thought is that rather than
> have a literal bookpart block in each file, I should be able to convert the
> block into a function that takes the title string parameter. If I can get
> this to work, then hopefully I can make the function smart enough to either
> render all voices (for the full score) or just a single voice (for parts).
>
> My problem is that I have defined the function, but I can't invoke it.
> Here's the function:
>
> scoreSection =
> #(define-scheme-function
> (parser location title)
> (string?)
>   #{
> \bookpart {
> \header {
>   piece = #title
> }
> \tocItem \markup #title
> \markup {
>   \italic "Notes other than C have different pitches than notated,
> as indicated by a number"
> }
> \markup {
>   \italic "in parentheses giving an offset in cents relative to
> the notated pitch, shown at"
> }
> \markup {
>   \italic "the first appearance of each note that requires
> alteration."
> }
> \score {
> \new StaffGroup \with { midiInstrument = "cello" } <<
> \new Staff \with { instrumentName = "String 1" }
> << \global \stringOne >>
> \new Staff \with { instrumentName = "String 2" }
> << \global \stringTwo >>
> \new Staff \with { instrumentName = "String 3" }
> << \global \stringThree >>
> \new Staff \with { instrumentName = "String 4" }
> << \global \stringFour >>
> \new Staff \with { instrumentName = "String 5" }
> << \global \stringFive >>
> \new Staff \with { instrumentName = "String 6" }
> << \global \stringSix >>
> \new Staff \with { instrumentName = "String 7" }
> << \global \stringSeven >>
> >>
> \layout { }
> \midi { }
> }
> }
>   #})
>
> And I am trying to invoke it using
>
> \scoreSection #"Part 1"
>
>
> but I keep getting the error messages like this:
>
> Parsing...
> hexany_permutations.ly:127:1: error: bad expression type
>
> \scoreSection #"Part 1"
>
>
> What am I doing wrong? I'm a Lilypond and Scheme newbie (but a programmer
> by trade).
>
> - Dave
>


newbie: help with Scheme functions

2020-10-18 Thread Dave Seidel
Hi,

I have a multi-section piece, with a master .ly file that uses \include for
each of the sections of the piece. Each included file more or less follows
the pattern of the string quartet template that ships with Lilypond: a
series of macros, one per voice, followed by a \bookpart section that
builds a StaffGroup, with one Staff per voice. This bookpart block is
nearly identical in all the included files, with the exception of a title
string used for "piece" property in in a \header section and also also as a
\tocItem.

This all works quite well, and I have a nice score with everything. Now I'd
like to be able to produce parts, and my thought is that rather than have a
literal bookpart block in each file, I should be able to convert the block
into a function that takes the title string parameter. If I can get this to
work, then hopefully I can make the function smart enough to either render
all voices (for the full score) or just a single voice (for parts).

My problem is that I have defined the function, but I can't invoke it.
Here's the function:

scoreSection =
#(define-scheme-function
(parser location title)
(string?)
  #{
\bookpart {
\header {
  piece = #title
}
\tocItem \markup #title
\markup {
  \italic "Notes other than C have different pitches than notated,
as indicated by a number"
}
\markup {
  \italic "in parentheses giving an offset in cents relative to the
notated pitch, shown at"
}
\markup {
  \italic "the first appearance of each note that requires
alteration."
}
\score {
\new StaffGroup \with { midiInstrument = "cello" } <<
\new Staff \with { instrumentName = "String 1" }
<< \global \stringOne >>
\new Staff \with { instrumentName = "String 2" }
<< \global \stringTwo >>
\new Staff \with { instrumentName = "String 3" }
<< \global \stringThree >>
\new Staff \with { instrumentName = "String 4" }
<< \global \stringFour >>
\new Staff \with { instrumentName = "String 5" }
<< \global \stringFive >>
\new Staff \with { instrumentName = "String 6" }
<< \global \stringSix >>
\new Staff \with { instrumentName = "String 7" }
<< \global \stringSeven >>
>>
\layout { }
\midi { }
}
}
  #})

And I am trying to invoke it using

\scoreSection #"Part 1"


but I keep getting the error messages like this:

Parsing...
hexany_permutations.ly:127:1: error: bad expression type

\scoreSection #"Part 1"


What am I doing wrong? I'm a Lilypond and Scheme newbie (but a programmer
by trade).

- Dave


Help with HEJI fonts

2020-10-15 Thread Dave Seidel
Hello,

I am trying to HEJI microtonal notation with Lilypond, using the OTF fonts
downloaded from plainsound.org, and the microlily package (originally by
Graham Breed and now being worked on by Konstantin Steuer). The specific
problem I'm having is that Lilypond does not seem to load or use these
fonts.

Here's the code I'm currently using to test this, not getting into the
microlily code at all

\markup { saldkfjh }
\paper{ myStaffSize = #20 #(define fonts (make-pango-font-tree "HEJI"
"HEJI" "HEJI" (/ myStaffSize 20))) }

which should print some glyphs from the font, but only prints the normal
letters.

I have tried this on both Windows 10 and Linux, with the fonts installed as
system fonts on both systems. I have also tried installing TTF versions of
the fonts, but with the same negative results.

Is there something else I need to do with these fonts so that
Lilypond will load them, such as copying them to some specific disk
location?

Proviso: I am a Lilypond and Scheme newbie (though no newbie to either
music or programming).

Thanks,
Dave