Re: Tempo changes and spanners

2024-07-24 Thread Tom Brennan
I really appreciate your work on that! It's also a very instructive example
to emulate, I imagine.

One quick question -- is this "lattice" idea I'm doing (maintaining a
separate voice with nothing but tempo and spaces that gets munged into the
parts) a bad idea for any reason? Would I ever run into issues with
spacing/direction, possibly run out of available voices, etc.? From the
documentation about `\voices` the count appears to be open-ended and the
configuration is pretty straightforward.

Does anyone else do this? Or do most people just repeat tempo/text markings
in all of the parts?

Thanks again!
Tom

On Tue, Jul 23, 2024 at 6:32 PM Thomas Morley 
wrote:

> Am Di., 23. Juli 2024 um 23:52 Uhr schrieb Tom Brennan  >:
> >
> > Hi all
> >
> > I'm notating a sonata for a cello and piano, and I would like to produce
> three "artifacts" (products?) from this:
> >
> > 1. A solo cello part (a typical single staff representation)
> > 2. A "study score" where all staves are equivalent sizes
> > 3. An accompaniment part for the piano, where the cello is above in a
> smaller staff
> >
> > Now, the problem I'm facing is that there are plenty of "accel." and
> "rit." marks with lines/spanners that I would like to be treated like tempo
> markings, so that they are presented in the following ways:
> >
> > 1. Normally for the solo cello part
> > 2. Only above the entire system in the "study score" product
> > 3. Above both the piano and the solo part in the "accompaniment" product
> >
> > The way I have designed the music input is like:
> >
> > ```
> > lattice = { s1 \tempo "Andante" 4 = 72 | s1 }
> > cello = << \lattice \relative c { a4 b c2 | d1 } >>
> > left = << \lattice { ...some music... } >>
> > right = << \latttice { ... } >>
> > ```
> >
> > i.e., so that the tempo lives in its own spaced-out voice, which
> provides the tempo to the rest of the staves but doesn't have its own staff
> to print. This seems to work, but I'm missing some key knowledge about how
> to handle the above scenarios. In particular, I don't know how to
> >
> > 1. treat a tempo marking and/or textmark as a spanner, so that it can
> have a dotted connecting line between tempo changes
> > 2. toggle these tempo changes based on the requirements above --
> sometimes only above the whole system, sometimes above the grand staff and
> the cello part (but not the left hand)
> >
> > I haven't been able to find the right documentation for this -- it seems
> like the only way to use a spanner is within a particular staff. Perhaps my
> approach is completely wrong, and I would love to know the best approach. I
> imagine this has to be a common (and hence solved) problem.
> >
> > Thanks
> > Tom
>
> Tempo-spanners are not yet implemented.
>
> Though we have an issue for it:
> https://gitlab.com/lilypond/lilypond/-/issues/3176
> You'll find a workaround there:
> https://gitlab.com/lilypond/lilypond/-/issues/3176#note_1277019697
>
> Furthermore I tried a proper implementation, see:
> https://gitlab.com/lilypond/lilypond/-/merge_requests/2256
> Though, a problem arises as soon as the relevant engravers are moved
> around. This is unsolved...
>
> Anyway, you may use the workaround from the issue or grap the code
> from the MR, in most cases it will work.
> Though, no garantee...
>
> Cheers,
>   Harm
>


Tempo changes and spanners

2024-07-23 Thread Tom Brennan
Hi all

I'm notating a sonata for a cello and piano, and I would like to produce
three "artifacts" (products?) from this:

1. A solo cello part (a typical single staff representation)
2. A "study score" where all staves are equivalent sizes
3. An accompaniment part for the piano, where the cello is above in a
smaller staff

Now, the problem I'm facing is that there are plenty of "accel." and "rit."
marks with lines/spanners that I would like to be treated like tempo
markings, so that they are presented in the following ways:

1. Normally for the solo cello part
2. Only above the entire system in the "study score" product
3. Above both the piano and the solo part in the "accompaniment" product

The way I have designed the music input is like:

```
lattice = { s1 \tempo "Andante" 4 = 72 | s1 }
cello = << \lattice \relative c { a4 b c2 | d1 } >>
left = << \lattice { ...some music... } >>
right = << \latttice { ... } >>
```

i.e., so that the tempo lives in its own spaced-out voice, which provides
the tempo to the rest of the staves but doesn't have its own staff to
print. This seems to work, but I'm missing some key knowledge about how to
handle the above scenarios. In particular, I don't know how to

1. treat a tempo marking and/or textmark as a spanner, so that it can have
a dotted connecting line between tempo changes
2. toggle these tempo changes based on the requirements above -- sometimes
only above the whole system, sometimes above the grand staff and the cello
part (but not the left hand)

I haven't been able to find the right documentation for this -- it seems
like the only way to use a spanner is within a particular staff. Perhaps my
approach is completely wrong, and I would love to know the best approach. I
imagine this has to be a common (and hence solved) problem.

Thanks
Tom


Barline scaling issues

2024-07-11 Thread Tom Brennan
Hi all

When using `\magnifyStaff #2/3`, I'm seeing weird transitions between the
staves of a `StaffGroup`. For example,

```
\version "2.24.3"

music = \relative c'' {
\repeat unfold 10 { c4 d e f } \bar "||" c d e f \bar "|."
}

% Weird transition between I and II -- I "wins"
\bookpart {
\new StaffGroup {
<<
\tag #'a-normal {
\new Staff \with {
instrumentName = "Inst I"
shortInstrumentName = "I"
\RemoveEmptyStaves
} { \music }
}
\tag #'b-small {
\new Staff \with {
instrumentName = "Inst II"
shortInstrumentName = "II"
\magnifyStaff #2/3
\RemoveEmptyStaves
} { \music }
}
>>
}
}
```

which produces this:

[image: image.png]

You can see the staff size transition -- the top one "wins" in the sense
that its larger barlines are longer. If you flip the magnification from the
bottom to the top, then the smaller lines "win" and they are longer
instead, meaning that the staff on top seems to always be the one chosen to
dictate the barline vertical span.

It looks like you can get the barlines to be consistent by using the
following workaround in a staff `\with` block:

```
fontSize = #-3
\override StaffSymbol.staff-space = #(magstep -3)
```

But I figure this (basically a constant cue staff) probably isn't a great
use for a StaffGroup, though. If you look at this Mozart example
 the StaffGroup is grouping
two staves of the same size, whereas in this Ravel example
, where it looks like a
cello part of a duo/duet because the violin is smaller, the staves aren't
grouped. I think the Ravel example is probably what I'm looking for, but
when you do this kind of thing, where there are exactly the same number of
bars in each staff, the final barline incorrectly leaves room at the end of
the staff:

```
\version "2.24.3"

music = \relative c'' {
\repeat unfold 10 { c4 d e f } \bar "||" c d e f \bar "|."
}

% No `StaffGroup` -- right padding/margin on small staff should not be there
\bookpart {
<<
{
\new Staff \with {
instrumentName = "Inst I"
shortInstrumentName = "I"
\magnifyStaff #2/3
\RemoveEmptyStaves
} { \music }
}
{
\new Staff \with {
instrumentName = "Inst II"
shortInstrumentName = "II"
\RemoveEmptyStaves
} { \music }
}
>>
}
```

which gives you this:

[image: image.png]

As you can see, there's a little bit of margin/padding on the right of the
final barline of the small staff. It could be fixed by using the
`StaffSymbol.staff-space` and `fontsize` workaround, but I think it
probably looks better to have these scaled-down barlines. The only issue is
that I think this last one needs to be positioned at the end of the staff,
small or not, like it is in the Ravel example above.

The question is, is this a bug or expected behavior? Is there a workaround
to get that barline to snap to the end?

Thanks
Tom


Re: Workaround for \grace + \tuplet bug

2024-07-08 Thread Tom Brennan
I just realized that guile 3 is available for 2.24.x, so that's the
workaround. I'll still file the bug, though, for v2.25 in the proper
channel.

Thanks
Tom

On Mon, Jul 8, 2024 at 11:40 AM Tom Brennan  wrote:

> Hi all
>
> I came across a bug with grace music containing tuplets and I haven't
> filed the report yet, because I'm waiting to be added to the bug list to
> provide the report there.
>
> However, I'm looking for a workaround for this problem. Here is the report:
>
> ```
> % Grace note music containing tuplets cannot contain other music after the
> % first tuplet. (The result is a segfault.)
> % Note: this compiles normally on at least "2.24.3"
> \version "2.25.18"
>
> music_that_does_not_work = \relative c'' {
> a4 b c
> \grace {
> \tuplet 3/2 { a16 b c }
> g32 a
> }
> d4
> }
>
> music_that_works = \relative c'' {
> a4 b c
> \grace {
> g32 a
> \tuplet 3/2 { a16 b c }
> }
> d4
> }
>
> \score {
> {
> % uncomment the following to get a segfault:
> % \music_that_does_not_work
> \bar "||"
> \music_that_works
> }
> }
> ```
>
> This is only a problem in version 2.25.x, but I'm specifically using that
> version to gain access to guile 3, so downgrading to 2.24.x doesn't work
> for my situation.
>
> Does this sound like low hanging fruit? Is there a workaround maybe?
>
> Thanks!
> Tom
>


Workaround for \grace + \tuplet bug

2024-07-08 Thread Tom Brennan
Hi all

I came across a bug with grace music containing tuplets and I haven't filed
the report yet, because I'm waiting to be added to the bug list to provide
the report there.

However, I'm looking for a workaround for this problem. Here is the report:

```
% Grace note music containing tuplets cannot contain other music after the
% first tuplet. (The result is a segfault.)
% Note: this compiles normally on at least "2.24.3"
\version "2.25.18"

music_that_does_not_work = \relative c'' {
a4 b c
\grace {
\tuplet 3/2 { a16 b c }
g32 a
}
d4
}

music_that_works = \relative c'' {
a4 b c
\grace {
g32 a
\tuplet 3/2 { a16 b c }
}
d4
}

\score {
{
% uncomment the following to get a segfault:
% \music_that_does_not_work
\bar "||"
\music_that_works
}
}
```

This is only a problem in version 2.25.x, but I'm specifically using that
version to gain access to guile 3, so downgrading to 2.24.x doesn't work
for my situation.

Does this sound like low hanging fruit? Is there a workaround maybe?

Thanks!
Tom


Re: Re[4]: Frescobaldi?

2024-05-06 Thread Tom Brennan
I think that all sounds good, but that kind of rework is probably
going to involve a lot of regression risk (what are the tests like
right now?), but also a ton of opportunities for improvements to the
extent that it might be a good time to make a break from backward
functional compatibility, maybe brand it as something else, and market
it as the next gen or something like that. It sounds like the code as
it is is in kind of a bad state, we've got people here on this list
that care about that code but don't have time to do much more than
review your changes, but then you are showing a lot of initiative to
contribute and have the skills and interest to take this kind of
project on. We could all just take a step back and see what you do?

On Mon, May 6, 2024 at 10:06 AM Steph Phillips  wrote:
>
> Well, I'm glad you asked about feedback because I'm curious what other
> folks who contribute to Frescobaldi might think.
>
> After digging around in the codebase, I'm wondering if the application
> might benefit from a more object-oriented design. It's definitely in
> Python, but with more of C-style approach. You've worked on it, you know
> what I'm talking about. Was wondering what your thoughts are.
>
> Additionally, I was wondering if it might benefit from typehinting
> throughout the codebase to allow for easier maintenance and plugin
> development.
>
> Thoughts? ♥
>
> -- Original Message --
> From "Jean Abou Samra" 
> To "Steph Phillips" ; "Graham King"
> ; "N. Andrew Walsh" 
> Cc "Lilypond-User Mailing List" 
> Date 5/6/2024 7:00:17 AM
> Subject Re: Re[2]: Frescobaldi?
>
> >
> >>  Hey all, I've been looking over the Frescobaldi codebase for the last
> >>  few days, and it seems to be within the realm of something I could pick
> >>  up maintenance for.
> >>
> >>  There would definitely be a learning curve, so hopefully it doesn't
> >>  reach it's EOL too soon... But, I don't know, I feel pretty confident.
> >>
> >>  Not really sure what more info I can contribute to the public discourse
> >>  at this point, but I welcome anyone else interested with the upkeep of
> >>  Frescobaldi to get in touch with me so we can coordinate~
> >
> >
> >
> >I'd encourage you to start by fixing some small issues to get acquainted
> >with the code. Then if you want to do the Qt 6 port, work on a branch
> >and make it public so I (for example) can have a look (don't wait for
> >having finished the port before seeking feedback).
> >
> >Thanks,
> >Jean
> >
> >
>



Re: organizing shared libraries

2024-04-04 Thread Tom Brennan
Sort of answering my own question, but I figure that you don't get
much out of creating scheme modules directly, unless they can live
entirely outside of the lilypond world. Generally it seems better to
create shared libraries somewhere and include them with
`--include/-I`.

On Wed, Apr 3, 2024 at 2:21 PM Tom Brennan  wrote:
>
> Hello
>
> I'm going through documentation, refamiliarizing myself with Lilypond,
> and trying to define a process for daily work that I like. One thing
> I'm pretty sure I'll want is to create a shared library that will live
> in its own repository. Perhaps more than one.
>
> Looking at [this
> documentation](https://lilypond.org/doc/v2.24/Documentation/notation/including-lilypond-files),
> what I think makes sense is to bundle the `*.ly` files into a guile
> module like `lib.scm`, using something like `ly:parse-init` to import
> `lib.ly` which would `\include` all the other `*.ly` files, sort of
> like the way it's done in `lily.scm` for `declarations-init.ly`. And
> then I would import the guile module that would bootstrap everything
> like `#(use-modules (special module))` in a particular project.
> Assuming the guile module makes it into the %load-path.
>
> There's probably a simpler way to do this and I'm just overthinking
> it. What do other people like doing for shared ly libraries?
>
> Thanks
> Tom



organizing shared libraries

2024-04-03 Thread Tom Brennan
Hello

I'm going through documentation, refamiliarizing myself with Lilypond,
and trying to define a process for daily work that I like. One thing
I'm pretty sure I'll want is to create a shared library that will live
in its own repository. Perhaps more than one.

Looking at [this
documentation](https://lilypond.org/doc/v2.24/Documentation/notation/including-lilypond-files),
what I think makes sense is to bundle the `*.ly` files into a guile
module like `lib.scm`, using something like `ly:parse-init` to import
`lib.ly` which would `\include` all the other `*.ly` files, sort of
like the way it's done in `lily.scm` for `declarations-init.ly`. And
then I would import the guile module that would bootstrap everything
like `#(use-modules (special module))` in a particular project.
Assuming the guile module makes it into the %load-path.

There's probably a simpler way to do this and I'm just overthinking
it. What do other people like doing for shared ly libraries?

Thanks
Tom



Re: Point and click - permission denied

2024-03-22 Thread Tom Brennan
Ok, I just noticed that the binary location is wrong -- and I have
more than one install on this computer, so I'm going to remove both
and start with the latest version and see what happens.

On Fri, Mar 22, 2024 at 10:20 AM Tom Brennan  wrote:
>
> BTW, for what it's worth it does still seem to be an apparmor issue.
> The output from dmesg is
>
> ```
> [ 8087.871623] audit: type=1400 audit(177091.247:143):
> apparmor="DENIED" operation="exec" profile="/usr/bin/evince"
> name="/usr/local/bin/lilypond-wrapper.guile" pid=65082 comm="sh"
> requested_mask="x" denied_mask="x" fsuid=1000 ouid=0
> [ 8087.871694] audit: type=1400 audit(177091.247:144):
> apparmor="DENIED" operation="exec" profile="/usr/bin/evince"
> name="/usr/bin/lilypond-invoke-editor" pid=65082 comm="sh"
> requested_mask="x" denied_mask="x" fsuid=1000 ouid=0
> [ 8087.871698] audit: type=1400 audit(177091.247:145):
> apparmor="DENIED" operation="exec" profile="/usr/bin/evince"
> name="/usr/bin/lilypond-invoke-editor" pid=65082 comm="sh"
> requested_mask="x" denied_mask="x" fsuid=1000 ouid=0
> ```
>
> On Fri, Mar 22, 2024 at 9:19 AM Tom Brennan  wrote:
> >
> > Hello
> >
> > (Note: this email uses markdown formatting.)
> >
> > It's been a while since I've used lilypond, and I had point and click
> > working on another system, but I can't remember what I did. I do
> > remember there were hiccups. Also, it was probably Arch Linux and now
> > the distro I'm using is Ubuntu 22.04, Lilypond version 2.22.2.
> >
> > I want to set up point and click with VS Code, ultimately, and I open
> > the pdf from a terminal emulator with xdg-open (I believe the app that
> > opens it is called "evince" but it just displays "Document Viewer".
> >
> > First I updated the `LYEDITOR` to point to VS Code with its required
> > CLI arguments.
> >
> > ```
> > ~/Workspace/my-lilypond-project$ lilypond main.ly
> > ~/Workspace/my-lilypond-project$ xdg-open main.pdf
> > ~/Workspace/my-lilypond-project$ export LYEDITOR="code --goto
> > %(file)s:%(line)s:%(column)s"
> > ```
> >
> > From there I right-clicked a clickable thing and copied its address to
> > try it out with the CLI:
> >
> > ```
> > ~/Workspace/my-lilypond-project$ lilypond-invoke-editor
> > textedit:///home/tjb1982/Workspace/my-lilypond-project/./movement-foo/cello.ly:27:107:108
> > ```
> >
> > And this worked as expected, so then I went to configure xdg-mime to
> > handle the `x-scheme-handler/textedit` mimetype as per the docs
> > [here](https://lilypond.org/doc/v2.25/Documentation/usage/using-gnome-for-point-and-click).
> >
> > ```shell
> > ~/Workspace/my-lilypond-project$ cd /tmp
> > /tmp$ cat <<_EOF > lilypond-invoke-editor.desktop
> > [Desktop Entry]
> > Version=1.0
> > Name=lilypond-invoke-editor
> > GenericName=Textedit URI handler
> > Comment=URI handler for textedit:
> > Exec=lilypond-invoke-editor %u
> > Terminal=false
> > Type=Application
> > MimeType=x-scheme-handler/textedit;
> > Categories=Editor
> > NoDisplay=true
> > _EOF
> > /tmp$ xdg-desktop-menu install ./lilypond-invoke-editor.desktop
> > /tmp$ xdg-mime default lilypond-invoke-editor.desktop 
> > x-scheme-handler/textedit
> > /tmp$ cd -
> > ~/Workspace/my-lilypond-project$ lilypond main.ly
> > ~/Workspace/my-lilypond-project$ xdg-open main.pdf
> > ```
> >
> > From here, clicking on a clickable item in the pdf results in the
> > console logging:
> >
> > ```
> > sh: 1: exec: lilypond-invoke-editor: Permission denied
> > ```
> >
> > I found the thread
> > [here](https://lists.gnu.org/archive/html/lilypond-user/2019-02/msg00276.html)
> > where David Sumbler figured out some required configuration for
> > apparmor and evince, so I tried to follow the same process. I already
> > had a file at `/etc/apparmor.d/usr.bin.evince`, so I edited the
> > `/usr/bin/evince` section of the file like this:
> >
> > ```
> > /usr/bin/evince {
> >   ...
> >   /usr/local/bin/lilypond-invoke-editor Cx -> sanitized_helper,
> > }
> > ```
> >
> > I ran the parser, double-checked that this is the actual location of
> > `lilypond-invoke-editor`, and restarted the apparmor service:
> >
> > ```
> > ~$ sudo apparmor_parser 

Re: Point and click - permission denied

2024-03-22 Thread Tom Brennan
BTW, for what it's worth it does still seem to be an apparmor issue.
The output from dmesg is

```
[ 8087.871623] audit: type=1400 audit(177091.247:143):
apparmor="DENIED" operation="exec" profile="/usr/bin/evince"
name="/usr/local/bin/lilypond-wrapper.guile" pid=65082 comm="sh"
requested_mask="x" denied_mask="x" fsuid=1000 ouid=0
[ 8087.871694] audit: type=1400 audit(177091.247:144):
apparmor="DENIED" operation="exec" profile="/usr/bin/evince"
name="/usr/bin/lilypond-invoke-editor" pid=65082 comm="sh"
requested_mask="x" denied_mask="x" fsuid=1000 ouid=0
[ 8087.871698] audit: type=1400 audit(177091.247:145):
apparmor="DENIED" operation="exec" profile="/usr/bin/evince"
name="/usr/bin/lilypond-invoke-editor" pid=65082 comm="sh"
requested_mask="x" denied_mask="x" fsuid=1000 ouid=0
```

On Fri, Mar 22, 2024 at 9:19 AM Tom Brennan  wrote:
>
> Hello
>
> (Note: this email uses markdown formatting.)
>
> It's been a while since I've used lilypond, and I had point and click
> working on another system, but I can't remember what I did. I do
> remember there were hiccups. Also, it was probably Arch Linux and now
> the distro I'm using is Ubuntu 22.04, Lilypond version 2.22.2.
>
> I want to set up point and click with VS Code, ultimately, and I open
> the pdf from a terminal emulator with xdg-open (I believe the app that
> opens it is called "evince" but it just displays "Document Viewer".
>
> First I updated the `LYEDITOR` to point to VS Code with its required
> CLI arguments.
>
> ```
> ~/Workspace/my-lilypond-project$ lilypond main.ly
> ~/Workspace/my-lilypond-project$ xdg-open main.pdf
> ~/Workspace/my-lilypond-project$ export LYEDITOR="code --goto
> %(file)s:%(line)s:%(column)s"
> ```
>
> From there I right-clicked a clickable thing and copied its address to
> try it out with the CLI:
>
> ```
> ~/Workspace/my-lilypond-project$ lilypond-invoke-editor
> textedit:///home/tjb1982/Workspace/my-lilypond-project/./movement-foo/cello.ly:27:107:108
> ```
>
> And this worked as expected, so then I went to configure xdg-mime to
> handle the `x-scheme-handler/textedit` mimetype as per the docs
> [here](https://lilypond.org/doc/v2.25/Documentation/usage/using-gnome-for-point-and-click).
>
> ```shell
> ~/Workspace/my-lilypond-project$ cd /tmp
> /tmp$ cat <<_EOF > lilypond-invoke-editor.desktop
> [Desktop Entry]
> Version=1.0
> Name=lilypond-invoke-editor
> GenericName=Textedit URI handler
> Comment=URI handler for textedit:
> Exec=lilypond-invoke-editor %u
> Terminal=false
> Type=Application
> MimeType=x-scheme-handler/textedit;
> Categories=Editor
> NoDisplay=true
> _EOF
> /tmp$ xdg-desktop-menu install ./lilypond-invoke-editor.desktop
> /tmp$ xdg-mime default lilypond-invoke-editor.desktop 
> x-scheme-handler/textedit
> /tmp$ cd -
> ~/Workspace/my-lilypond-project$ lilypond main.ly
> ~/Workspace/my-lilypond-project$ xdg-open main.pdf
> ```
>
> From here, clicking on a clickable item in the pdf results in the
> console logging:
>
> ```
> sh: 1: exec: lilypond-invoke-editor: Permission denied
> ```
>
> I found the thread
> [here](https://lists.gnu.org/archive/html/lilypond-user/2019-02/msg00276.html)
> where David Sumbler figured out some required configuration for
> apparmor and evince, so I tried to follow the same process. I already
> had a file at `/etc/apparmor.d/usr.bin.evince`, so I edited the
> `/usr/bin/evince` section of the file like this:
>
> ```
> /usr/bin/evince {
>   ...
>   /usr/local/bin/lilypond-invoke-editor Cx -> sanitized_helper,
> }
> ```
>
> I ran the parser, double-checked that this is the actual location of
> `lilypond-invoke-editor`, and restarted the apparmor service:
>
> ```
> ~$ sudo apparmor_parser -r -T -W /etc/apparmor.d/usr.bin.evince
> ~$ echo $?
> 0
> ~$ which lilypond-invoke-editor
> /usr/local/bin/lilypond-invoke-editor
> ~$ sudo systemctl restart apparmor
> ~$ sudo systemctl status apparmor
> ● apparmor.service - Load AppArmor profiles
>  Loaded: loaded (/lib/systemd/system/apparmor.service; enabled;
> vendor preset: enabled)
>  Active: active (exited) since Fri 2024-03-22 09:12:02 EDT; 1s ago
>Docs: man:apparmor(7)
>  https://gitlab.com/apparmor/apparmor/wikis/home/
> Process: 24362 ExecStart=/lib/apparmor/apparmor.systemd reload
> (code=exited, status=0/SUCCESS)
>Main PID: 24362 (code=exited, status=0/SUCCESS)
> CPU: 161ms
>
> Mar 22 09:12:02 chester 

Point and click - permission denied

2024-03-22 Thread Tom Brennan
Hello

(Note: this email uses markdown formatting.)

It's been a while since I've used lilypond, and I had point and click
working on another system, but I can't remember what I did. I do
remember there were hiccups. Also, it was probably Arch Linux and now
the distro I'm using is Ubuntu 22.04, Lilypond version 2.22.2.

I want to set up point and click with VS Code, ultimately, and I open
the pdf from a terminal emulator with xdg-open (I believe the app that
opens it is called "evince" but it just displays "Document Viewer".

First I updated the `LYEDITOR` to point to VS Code with its required
CLI arguments.

```
~/Workspace/my-lilypond-project$ lilypond main.ly
~/Workspace/my-lilypond-project$ xdg-open main.pdf
~/Workspace/my-lilypond-project$ export LYEDITOR="code --goto
%(file)s:%(line)s:%(column)s"
```

>From there I right-clicked a clickable thing and copied its address to
try it out with the CLI:

```
~/Workspace/my-lilypond-project$ lilypond-invoke-editor
textedit:///home/tjb1982/Workspace/my-lilypond-project/./movement-foo/cello.ly:27:107:108
```

And this worked as expected, so then I went to configure xdg-mime to
handle the `x-scheme-handler/textedit` mimetype as per the docs
[here](https://lilypond.org/doc/v2.25/Documentation/usage/using-gnome-for-point-and-click).

```shell
~/Workspace/my-lilypond-project$ cd /tmp
/tmp$ cat <<_EOF > lilypond-invoke-editor.desktop
[Desktop Entry]
Version=1.0
Name=lilypond-invoke-editor
GenericName=Textedit URI handler
Comment=URI handler for textedit:
Exec=lilypond-invoke-editor %u
Terminal=false
Type=Application
MimeType=x-scheme-handler/textedit;
Categories=Editor
NoDisplay=true
_EOF
/tmp$ xdg-desktop-menu install ./lilypond-invoke-editor.desktop
/tmp$ xdg-mime default lilypond-invoke-editor.desktop x-scheme-handler/textedit
/tmp$ cd -
~/Workspace/my-lilypond-project$ lilypond main.ly
~/Workspace/my-lilypond-project$ xdg-open main.pdf
```

>From here, clicking on a clickable item in the pdf results in the
console logging:

```
sh: 1: exec: lilypond-invoke-editor: Permission denied
```

I found the thread
[here](https://lists.gnu.org/archive/html/lilypond-user/2019-02/msg00276.html)
where David Sumbler figured out some required configuration for
apparmor and evince, so I tried to follow the same process. I already
had a file at `/etc/apparmor.d/usr.bin.evince`, so I edited the
`/usr/bin/evince` section of the file like this:

```
/usr/bin/evince {
  ...
  /usr/local/bin/lilypond-invoke-editor Cx -> sanitized_helper,
}
```

I ran the parser, double-checked that this is the actual location of
`lilypond-invoke-editor`, and restarted the apparmor service:

```
~$ sudo apparmor_parser -r -T -W /etc/apparmor.d/usr.bin.evince
~$ echo $?
0
~$ which lilypond-invoke-editor
/usr/local/bin/lilypond-invoke-editor
~$ sudo systemctl restart apparmor
~$ sudo systemctl status apparmor
● apparmor.service - Load AppArmor profiles
 Loaded: loaded (/lib/systemd/system/apparmor.service; enabled;
vendor preset: enabled)
 Active: active (exited) since Fri 2024-03-22 09:12:02 EDT; 1s ago
   Docs: man:apparmor(7)
 https://gitlab.com/apparmor/apparmor/wikis/home/
Process: 24362 ExecStart=/lib/apparmor/apparmor.systemd reload
(code=exited, status=0/SUCCESS)
   Main PID: 24362 (code=exited, status=0/SUCCESS)
CPU: 161ms

Mar 22 09:12:02 chester systemd[1]: Starting Load AppArmor profiles...
Mar 22 09:12:02 chester apparmor.systemd[24362]: Restarting AppArmor
Mar 22 09:12:02 chester apparmor.systemd[24362]: Reloading AppArmor profiles
Mar 22 09:12:02 chester apparmor.systemd[24379]: Skipping profile in
/etc/apparmor.d/disable: usr.sbin.rsyslogd
Mar 22 09:12:02 chester systemd[1]: Finished Load AppArmor profiles.
```

This didn't change anything (still getting the permission denied error
when clicking).

I also tried to stop the apparmor service and then reboot

```
~$ sudo systemctl stop apparmor
~$ sudo systemctl disable apparmor
```

This didn't have any effect. What should I try next?

Thanks,
Tom



Re: How to unsubscribe?

2023-05-05 Thread Tom Brennan
TIL

On Fri, May 5, 2023 at 12:47 PM Mark Stephen Mrotek 
wrote:

> David,
>
> Your response assumes that all readers of mailing lists know what full
> headers are, where the full headers are, and where in the full headers to
> find the "unsubscribe".
>
> Mark
>
> -Original Message-
> From: lilypond-user-bounces+carsonmark=ca.rr@gnu.org
> [mailto:lilypond-user-bounces+carsonmark=ca.rr@gnu.org] On Behalf Of
> David Kastrup
> Sent: Friday, May 5, 2023 9:34 AM
> To: Samuel Sloniker 
> Cc: lilypond-user@gnu.org
> Subject: Re: How to unsubscribe?
>
> "Samuel Sloniker"  writes:
>
> > Hello!
> >
> > How can I unsubscribe from this list?
>
> Like with most bonafide mailing lists, looking at the full headers of any
> mail from the list will contain the necessary info for unsubscribing.
>
> --
> David Kastrup
>
>
>


large-scale example projects repositories

2021-07-02 Thread Tom Brennan
Hello

Are there any large-scale, "real-world" lilypond projects available online
to view so that I can see how they're organized? I know that I've seen some
documentation here and there that describes what you _would_ do if you had
a string quartet project, for example, but I'd like to see someone's actual
code for a non-trivial project so I can get a sense of how they keep it
nice and well-organized. An example of a large-scale project would be a
multi-movement orchestral piece, or even a multi-movement chamber piece,
like a pierrot ensemble kind of thing, especially one that incorporates
some non-trivial customizations with scheme, et al. Definitely there are a
thousand ways to organize a project, and I've developed my own way over
time that works alright, but if I could see examples of other projects, I
might be able to get ideas about improving my productivity.

The docs are pretty sparing when it comes to talking about this point (e.g.
http://lilypond.org/doc/v2.23/Documentation/usage/large-projects). I've
also found some people online who described what they do, but it would be
so much more informative to see this done in practice, especially if it
were pieces the community could vote on as being "representative" of a good
project organization. There are some medium-scale projects I found on
github (e.g., https://github.com/cellist/Lilypond-Sheet-Music). But it
would be nice to have a central place to go to search through with keywords
or tags, like the snippet repository. Is there something like this already
and I just haven't found it yet? Would anyone else be interested in
something like that if it doesn't already exist?

Thanks
Tom


Stem objects with symbols stamped on top

2021-04-15 Thread Tom Brennan
Hello

I'm trying to figure out how to temporarily change the stems in a staff so
that they appear like the "aeolian" stems displayed at the bottom of this
video (which has been queued to the relevant segment):
https://youtu.be/9cGJ-Y1EviI?t=57

I've seen how Penderecki tremolos are achieved; is there something like
that for Stem objects, perhaps using a list of predefined (or maybe even
arbitrary, postscript, etc.) symbols?

Thank you!
Tom


Re: Time bracket notation for very large scale compositions

2021-04-09 Thread Tom Brennan
Hi Andrew

I'm a professional software engineer, and I recently asked myself most of
the questions you're asking here when evaluating Lilypond, and ultimately,
I decided that for my usecases, it made more sense to use Lilypond, because
I would make a lot of use of the musical modeling/abstractions that do, as
you intuited, result in highly indirect control of the formatting that's
ultimately drawn.

Based on what you've written, my feeling is that you *could* choose to take
your existing programs/scripts together with a reasonable font, and
generate SVG and/or postscript files, et al., on your own. It's obviously a
lot of effort to make that work, and takes a different skillset, but you
could, eg, easily pipe output from a C program to the stdin of a python
script (or any general purpose language that has good library support for
the image/document format you're targeting). This will allow you to create
a much more manuscript-like experience and thought process than Lilypond
provides as its sort of "happy path," which I think of as more like a
declarative markup language (.ly) with an optional scripting language
(guile scheme) and APIs, a lot like what we have in a web browser with
HTML/JS.

That said, everything you can imagine doing with a general purpose
programming language is (probably) possible with Lilypond, but depending on
how unconventional your scores will need to look, or how precisely you need
the notation to be laid out, it might require more effort to learn how the
Lilypond architecture, lifecycles, interfaces, etc., work, which is not
trivial. But the community is great and your questions will be answered
promptly and thoughtfully. It does take time to learn, though; there's no
getting around that.

Tom


On Fri, Apr 9, 2021, 14:20 Shane Brandes  wrote:

> Greetings Andrew Culver,
>
> You have posted a pretty broad swathe of questions to the LilyPond
> Community. I suspect people will likely give a few responses. My personal
> use case is limited in comparison to things you might be undertaking. The
> Thalberg piano concerto is the largest thing I ever have typeset with
> Lilypond, and it ate that for breakfast. I would not describe myself as a
> power user and therefore don't have answers to many of the questions.
> However, to this point I have never seen someone show up on the list and
> find out something can't be done. It might take the extensibility provided
> by the magic of Scheme, which is a programming language, used to extend
> lilyponds abilities. As far as future proofing, Lilypond has an automated
> code updating program, which does very well with making sure the old code
> is compliant with the current version's standards. The only time that might
> break is if something very kludgy was done. Personally, I have only broken
> something once, but that was because many years ago I was using something
> absolutely not in the way it was intended to achieve some end. In terms of
> fussiness of laying out objects in a correct way, Lilypond does these
> things out of the box in a way that other programs I have used just don't
> approach. So for a very great percentage of things tweaking items (manually
> moving) is not necessary. And there are ways for working around tweaking
> bits of code without having to compile a whole vast document. So in any
> event, it is likely LilyPond is an excellent candidate for your needs,
> unfortunately I can't give all the answers, and really am looking forward
> to whatever discussion your missive generates. It is always interesting to
> learn what this program is capable of.
>
> kind regards,
> Shane Brandes
>
> On Fri, Apr 9, 2021 at 12:18 PM AHF  wrote:
>
>> Hello LilyPeople,
>>
>> I am looking into using LilyPond for future works. What I like about it
>> is the text input, which makes it very easy to integrate with the
>> collection of C programs and PostgreSQL functions I use to generate and
>> manage music for large-scale pieces. (I’m on a Mac.)
>>
>> I have been doing this since the late 1980’s, for John Cage's operas,
>> installations, and films, and for my own large-scale orchestral works, such
>> as “Ocean 1-133” for 150 musician soloists over 90 minutes — see the Merce
>> Cunningham work “Ocean" if you are interested.
>>
>> The parts for Ocean 1-133 (more than 3000 pages) were pulled from the
>> database and formatted using C code into the P-field file format of the
>> wonderful old Score program by Leland Smith. Like LilyPond, this format is
>> expressed with simple text files. Given the abandonment of Score and the
>> vibrancy of LilyPond, I want to know if I should be using LilyPond.
>>
>> The example below is from one of Cage’s Number pieces, demonstrating Time
>> Bracket notation. The important challenges for a notation program are:
>> - Each time bracket is centered on the page, and the system is only as
>> long as necessary.
>> - No barlines.
>> - Notes within the time bracket are distributed evenly horizontally.
>> There is no not

Re: Workaround for (not-allowed) numbers in variable names?

2021-03-05 Thread Tom Brennan
That's neat. I checked to see that unicode as well as whitespace seems to
work via quoting, too.

\version "2.22"
"rødgrød med fløde 123
和毛泽东 <<重上井冈山>>. 严永欣, 一九八八年.

久有归天愿
终过鬼门关
千里来寻归宿
春华变苍颜
到处群魔乱舞
更有妖雾盘绕
暗道入阴间
过了阎王殿
险处不须看

风雷动
旌旗奋
忆人寰
八十三年过去
弹指一挥间
中原千军逐蒋
城楼万众检阅
褒贬满载还
世上无难事
只怕我癫痫
" = { a b c }

clarinet = \new Voice {
\"rødgrød med fløde 123
和毛泽东 <<重上井冈山>>. 严永欣, 一九八八年.

久有归天愿
终过鬼门关
千里来寻归宿
春华变苍颜
到处群魔乱舞
更有妖雾盘绕
暗道入阴间
过了阎王殿
险处不须看

风雷动
旌旗奋
忆人寰
八十三年过去
弹指一挥间
中原千军逐蒋
城楼万众检阅
褒贬满载还
世上无难事
只怕我癫痫
"
}



On Fri, Mar 5, 2021, 11:45 stefano franchi 
wrote:
>
> Right, so I'm stupid. All it takes is to enclose the variable_with_number
names in quotes
>
> On Fri, Mar 5, 2021 at 10:37 AM stefano franchi 
wrote:
>>
>> Here is a question for anyone who may have been using lilypond for
projects involving text and many, many, short and similar musical snippets.
>>
>> I am putting together a book that will contain many (very brief)
 exercises, grouped thematically. I had thought a convenient and flexible
way to organize the material and keep future maintenance under control
would be to create top level variables names for the main musical
categories and sub-categories and then assign each score snippet to
progressively numbered variable. So I would have, CategA-1 = {"code for one
exercise"} , CategB-2 = "code for another exercise"}, and so on. Clean
structure, easy to maintain and rearrange, etc.
>>
>> Then I discovered that lilypond does not allow numbers in variable
names :-(
>>
>> I'd be willing to bet my use case is not particularly weird---there must
have been other people encountering the same problem.
>>
>> How have you guys managed it?
>>
>> Cheers,
>>
>> S.
>>
>>
>> --
>> __
>> Stefano Franchi
>>
>> stefano.fran...@gmail.com
>> https://www.researchgate.net/profile/Stefano_Franchi
>
>
>
> --
> __
> Stefano Franchi
>
> stefano.fran...@gmail.com
> https://www.researchgate.net/profile/Stefano_Franchi

>


Re: Questions about using Scheme with Lilypond

2020-11-16 Thread Tom Brennan
Hi Aaron

Thanks. That's very helpful. It looks like from your example you linked to
that there's probably a way to do just about anything in lilypond with
Scheme, and I just need to dive into the scm library files. The other part
is just learning how Scheme is different from Clojure (which is currently
the only lisp I'm familiar with).

Re: arity, the (admittedly unclear) question wasn't whether or not scheme
supports multi-arity, but whether you can "splat" any list (doesn't have to
be from args), into a block of lilypond code, i.e.,

%%%
\version 2.20.0
foo = #(lambda the_rest #{
\bookpart {
\score_one
\score_two
#the_rest % <= splat: assuming `the_rest` is a list of scores
}
#})


The above doesn't work for reasons other than the lambda's arity, and for
something like the above case, it looks like I'm probably better off using
some procedures form the scm library like `add-score` or something lower
level making use of `ly:parser-lookup` such as is done here:

```lily-library.scm
(define-public (add-score score)
(cond
((ly:parser-lookup '$current-bookpart)
((ly:parser-lookup 'bookpart-score-handler)
(ly:parser-lookup '$current-bookpart) score))
((ly:parser-lookup '$current-book)
((ly:parser-lookup 'book-score-handler)
(ly:parser-lookup '$current-book) score))
(else
((ly:parser-lookup 'toplevel-score-handler) score
```

But the question of whether you can apply a given list as arguments to a
lilypond directive like I'm exemplifying with "the_rest" above -- still
unclear about what is allowed in terms of interop with Scheme in these
blocks. Does that question make sense? That's why I brought up macros,
because in a general sense they make it possible to do (in Clojure, anyway)
"unquote-splicing", obviating using something like `apply`, etc. But since
you're in a lilypond block, it's just not clear to me what is allowed there
in terms of interpolating scheme values.

Thanks again
Tom


On Sun, Nov 15, 2020 at 6:07 PM Aaron Hill  wrote:

> On 2020-11-15 12:03 pm, Tom Brennan wrote:
> > I'd like to create a function that would allow me to create a
> > `bookpart`
> > from a list of arguments. E.g.,
> >
> > [...]
> >
> > Is this kind of thing possible?
>
> Yes-ish, see my post [1] last month about "returning" books and book
> parts.
>
> [1]:
> https://lists.gnu.org/archive/html/lilypond-user/2020-10/msg00406.html
>
>
> > 2. Applying variadic arguments (i.e., "splat"). E.g., in Clojure, you
> > can
> > do something like this:
> >
> > [...]
> >
> > but you can't just throw a list in right there, right? It would need to
> > be
> > expanded, in the `apply` sense. I assume Guile has macros, like
> > Clojure,
> > but I don't know how to use them yet. Would that path lead me to
> > success
> > here, though?
>
> Guile does support macros, although these are not needed for procedures
> of variable arity.  Consider:
>
> 
> \version "2.20.0"
>
> #(define (foo . args) (format #t "\nargs=~s" args))
> #(foo 1 2)
> #(foo 'a 'b 'c)
>
> #((lambda args (format #t "\nargs=~s" args)) 3 'd)
> 
>
> 
> Parsing...
> args=(1 2)
> args=(a b c)
> args=(3 d)
> 
>
> The problem you are hitting is that music functions must have fixed
> arity.  There is limited support for optional arguments, but the parser
> ultimately needs to know how much input will be consumed by a function.
> Otherwise, you could invoke a music function and potentially read to the
> end of the file.
>
> To work around this limitation, you can leverage existing constructs
> that contain variable numbers of things.  Consider a function that needs
> to accept one or more pitches.  You could instead accept ly:music? so
> multiple pitches are specified within curly braces (i.e. sequential
> music).  The music-pitches procedure will handle extracting the pitches
> from the provided music:
>
> 
> \version "2.20.0"
>
> baz = #(define-void-function (pitches) (ly:music?)
>(format #t "\npitches=~s" (music-pitches pitches)))
> \baz a
> \baz { b d f }
> 
>
> 
> Parsing...
> pitches=(#)
> pitches=(# # #)
> 
>
>
> -- Aaron Hill
>
>


Questions about using Scheme with Lilypond

2020-11-15 Thread Tom Brennan
I'd like to create a function that would allow me to create a `bookpart`
from a list of arguments. E.g.,

```lilypond
\book {
\custom_bookpart "horn" \hn_movt_one \hn_movt_two
}
```

The reason is because I'd like to reuse header and page info, etc, without
having to repeat those common variable names. I.e., replace this:

```lilypond
\book {
% clarinet
\bookpart {
\paper { ... }
\header {
...
instrument = \clarinet-name
}
\maestoso-clarinet-part
\scherzo-clarinet-part
}

% bassoon
\bookpart {
\paper { ... }
\header {
...
instrument = \bassoon-name
}
\maestoso-bassoon-part
\scherzo-bassoon-part
}
}
```

with this:

```lilypond
\book {
\part_bookpart \clarinet-name \maestoso-clarinet-part \scherzo-clarinet-part
\part_bookpart \horn-name \maestoso-hn-part \scherzo-hn-part
}
```


Is this kind of thing possible? I tried to create a music function, but I
got hung up on a number of things:

1. You can't return a `bookpart` from a music function, and it looks like
nothing happens when trying to return a `bookpart` from a scheme
function/lambda, too:

```lilypond
custom_bookpart = #(lambda args #{ \bookpart {...} #})
\book {
#(custom_bookpart "horn" \hn_movt_one)
}
```

I guess I was under the impression that anything you can create in lilypond
syntax can be created (also in some cases mutated?) in corresponding scheme
code, but I'm having a hard time figuring out how to inspect the objects
that result from various expressions (lilypond or scheme). E.g.,

```
custom_bookpart = #(lambda _ #{ \bookpart { ... } #})
#(display (custom_bookpart))
```

displays: #

Where do I find documentation about what a # is, and/or how do I
inspect its properties, etc.? Can I mutate this (i.e., add/remove
bookparts)? Why don't I get a # instead? It also seems like I
should be able to use this function as an expression in my book definition,
but it doesn't work.

2. Applying variadic arguments (i.e., "splat"). E.g., in Clojure, you can
do something like this:

```clojure
(defmacro foo [& body]
`(+ 1 ~@body))

(macroexpand '(foo 2 3 4))
=> (+ 1 2 3 4)
```

I tried using `custom_bookpart = #(lambda args ...)` like:
```lilypond
custom_bookpart = #(lambda args
#{
\bookpart {
\header { instrument = #(car args) }
#(cdr args)
}
#})
```

but you can't just throw a list in right there, right? It would need to be
expanded, in the `apply` sense. I assume Guile has macros, like Clojure,
but I don't know how to use them yet. Would that path lead me to success
here, though?

Thanks
Tom