Getting a function to accept a string or a markup

2024-05-09 Thread Vaughan McAlley
Hi,

I have a text spanner function that shows a player that they are playing in
simultaneous rhythm with one or more other players. I adapted it from code
I used for indicating colouration in renaissance music. It works fine, but
if it begins on the last note of a line, and the attached string is long,
it can extend right to the edge of the page (see picture attached).

What would be good is to be able to say

\sim \markup \left-column { "Vln 1," "Vln 2" }

if needed. Otherwise I could have it require a markup and get it to
concatenate within the function, but my Scheme skills are not up to this...

Thanks in advance,
Vaughan
\version "2.24.3"

%contrinuted by harm6
% after an idea by Nathan
% see: http://lists.gnu.org/archive/html/lilypond-user/2012-07/msg00036.html
% thanks to Mark Knoop

mySimBeginning = "┌ "
mySimEnding = "┐"

sim =
#(define-music-function (annotation)(string?) ; I want this to be a string or a markup
   #{
 \tag #'removeFromScore {
   \once \override TextSpanner.before-line-breaking =
   #(lambda (grob)
  (let* ((sz (ly:grob-property grob 'font-size 0.0))
 (mult (magstep sz)))
(begin
 (ly:grob-set-property! grob 'style 'none)
 (ly:grob-set-nested-property! grob
   '(bound-details left text)
   (markup #:scale (cons mult mult) (string-append mySimBeginning annotation)))
 (ly:grob-set-nested-property! grob
   '(bound-details right text)
   (markup #:scale (cons mult mult) mySimEnding))
 ;;Perhaps you may want to uncomment the following lines
 ;;and adjust the value (currently -0.5)
 (ly:grob-set-nested-property! grob
   '(bound-details left padding) -0.5)
 (ly:grob-set-nested-property! grob
   '(bound-details right padding) -0.5)
 (ly:grob-set-nested-property! grob
   '(bound-details left-broken text) #f)
 (ly:grob-set-nested-property! grob
   '(bound-details right-broken text) #f
   $(make-music 'EventChord 'elements (list
   (make-music
'TextSpanEvent
'span-direction -1)))
 }
   #})


simEnd = \tag #'removeFromScore \stopTextSpan

\score {
  \relative c' {
c4 \sim "Vln1" c c c |
\break
% here it would be useful to say
% \sim \markup \left-column { "Vln 1," "Vln, 2" }
c c \simEnd c \sim "Vln 1, Vln, 2" c |
\break
c c \simEnd c c |
  }
  \layout {}
}

\paper {
  ragged-right = ##t
}

[basic question] how to disable text spanners for the lower staff of a PianoStaff

2024-05-09 Thread James Harkins
I've got a piano staff (for guzheng, just notating on two staves), and an 
"accel." text spanner in a \global var.

The accel is printed in both staves of the piano staff.

I'd thought this would hide it from the lower staff:

  \new PianoStaff \with {
instrumentName = "古筝"
shortInstrumentName = "古筝"
  } <<
\new Staff = "up" << \global \zhengR >>
\new Staff = "down" \with { \remove Text_spanner_engraver }
<< \clef bass \global \zhengL >>
  >>

But it still appears.

Some magic incantation I'm missing... can anyone advise? Thanks.

hjh



Spacing of chords on a chord lead sheet

2024-05-09 Thread Raphael Mankin
I have  generated a chord lead sheet for a bass player with just the 
chords on it (\chordMode, no notes). After some  fiddling I got the bar 
lines and repeats printed.


However, the chord names are mono-spaced; they are not spaced according 
to their durations. So that if, for instance, I  have {ef2 ef4:maj7 
ef4:7} then each symbol occupies the same amount of space on the line. 
The first chord does not occupy double the space of the other two.


Is there a way of getting proportional spacing?

--




Re: MIDI format and MIDI resolution

2024-05-09 Thread David Kastrup
Giles Boardman  writes:

> Is that "no, you can't tell me" or "no, it can't be done? (Just
> kidding). Thanks very much. It will save me spending time looking.

It is "it is hardwired into the source code to a degree where it would
require some really heavy lifting to make it adaptable".

It would be easier (but not trivial) to hardwire it to a different fixed
value, but then your copy of LilyPond would be incompatible with
everybody else's which is a maintenance nightmare, meaning that it
should only be attempted by people who are probably versed enough as
programmers as to be able to contribute a variable-size tick.

"it can't be done" is not a thing with Free Software.  It's more like
"if you have to ask, you may be the wrong person to do this as your
first project".

-- 
David Kastrup



Re: MIDI format and MIDI resolution

2024-05-09 Thread Giles Boardman
Is that "no, you can't tell me" or "no, it can't be done? (Just kidding). 
Thanks very much. It will save me spending time looking.

From: David Kastrup 
Sent: 09 May 2024 18:41
To: Giles Boardman 
Cc: lilypond-user@gnu.org 
Subject: Re: MIDI format and MIDI resolution

Giles Boardman  writes:

> Hello,
> Can anyone tell me if it is possible to generate Midi format 0 files

No.

> and whether it is possible to control the resolution setting.

No.

> I have been standardising resolution for midi files from different
> sources and the value I chose is not the one output by Lilypond.

Why?  You can use MIDI processors to generate format 0 and change
resolution.

--
David Kastrup


Re: MIDI format and MIDI resolution

2024-05-09 Thread David Kastrup
Giles Boardman  writes:

> Hello,
> Can anyone tell me if it is possible to generate Midi format 0 files

No.

> and whether it is possible to control the resolution setting.

No.

> I have been standardising resolution for midi files from different
> sources and the value I chose is not the one output by Lilypond.

Why?  You can use MIDI processors to generate format 0 and change
resolution.

-- 
David Kastrup



MIDI format and MIDI resolution

2024-05-09 Thread Giles Boardman
Hello,
Can anyone tell me if it is possible to generate Midi format 0 files and 
whether it is possible to control the resolution setting. I have been 
standardising resolution for midi files from different sources and the value I 
chose is not the one output by Lilypond.

Thanks

Giles


Re: Showing fingering on top of slurs

2024-05-09 Thread Knute Snortum
On Thu, May 9, 2024 at 7:05 AM Paul McKay  wrote:

> Hi
> I want to show the fingering in front of the slurs. This should keep the
> fingerings evenly spaced vertically over the notes.  I have tried the
> following :
>
> \version "2.24.0"
> \language "english"
>
> \relative {
> \override Staff.Fingering.layer = 2 % fingering should overwrite
> slurs
> r4 r8 -1-3( 16-2-4 -1-5-2-4-3-5) }
>
> Fingerings still avoid the slurs.
> What am I missing?
>

I'm not sure what you want to achieve, but try adding the avoid-slur
property to the fingering:

\version "2.24.0"
\language "english"

\relative {
\override Staff.Fingering.layer = 2 % fingering should overwrite
slurs
\override Staff.Fingering.avoid-slur = #'ignore
r4 r8 -1-3( 16-2-4 -1-5-2-4-3-5) }

https://lilypond.org/doc/v2.24/Documentation/internals/slur


--
Knute Snortum


Re: Tie between staves of a PianoStaff

2024-05-09 Thread Werner LEMBERG


> Thanks for your contributions. They inspired me to an easy bypass:
> ties may not work between staves, but slurs do, and the difference
> is not really conspicuous.  [...]

By the way, the original problem is an ooold bug:

  https://gitlab.com/lilypond/lilypond/-/issues/555


 Werner



Showing fingerings in front of slurs

2024-05-09 Thread Paul McKay
Hi
I want to show fingerings in front of slurs in a manner very like that
demonstrated in the "Using the whiteout property" snippet

This is what I've tried:
\version "2.24.0"
\language "english"

\relative {
\override Staff.Fingering.layer = 2 % fingering should overwrite
slurs
 \override Staff.Fingering.whiteout = ##t
r4 r8 -1-3( 16-2-4 -1-5-2-4-3-5)
}

but the fingerings still avoid the slurs. I want them to appear just where
they would if the Slurs weren't there at all.
What am I missing?
Thanks
Paul McKay


Showing fingering on top of slurs

2024-05-09 Thread Paul McKay
Hi
I want to show the fingering in front of the slurs. This should keep the
fingerings evenly spaced vertically over the notes.  I have tried the
following :

\version "2.24.0"
\language "english"

\relative {
\override Staff.Fingering.layer = 2 % fingering should overwrite
slurs
r4 r8 -1-3( 16-2-4 -1-5-2-4-3-5) }

Fingerings still avoid the slurs.
What am I missing?
Thanks
Paul McKay


Re: Tie between staves of a PianoStaff

2024-05-09 Thread Knute Snortum
On Thu, May 9, 2024 at 6:27 AM Kris Van Bruwaene  wrote:

> Thanks for your contributions. They inspired me to an easy bypass: ties
> may not work between staves, but slurs do, and the difference is not really
> conspicuous. Result attached.
>

That's great!  I'd change one thing -- not related to cross-staves ties.
In the right-hand set of temporary voices, third voice, I'd start with
\voiceFour instead of \voiceThree.  Now the need for \stemDown \slurDown
goes away:

  \new Voice { \voiceFour % ties (actually slurs) between staves
  s2 b2( \change Staff = "down" \voiceOne b4) \change Staff = "up" s4 %
2
  }

Also, just for future reference, if you just have one slur or tie (or other
things like fematas) to change up or down, you can use the direction
indicators:

  b2_( % slur down
  b2^( % slur up


--
Knute Snortum


Re: Tie between staves of a PianoStaff

2024-05-09 Thread Kris Van Bruwaene
Thanks for your contributions. They inspired me to an easy bypass: ties may not 
work between staves, but slurs do, and the difference is not really 
conspicuous. Result attached.



On Wednesday, 8 May 2024 at 18:44:10 CEST, David Wright 
 wrote: 





On Wed 08 May 2024 at 13:40:23 (+), Kris Van Bruwaene wrote:

> Is there a simple solution for putting a tie between staves of a pianostaff? 
> I need to tie a note of the lower voice on the upper staff to a note of the 
> upper voice on the lower staff. I found this on StackExchange: 
> https://music.stackexchange.com/questions/74383/lilypond-ties-across-staves 
> but it's five years old and seems rather difficult to implement.
> I use version 2.24.2 on Debian.


I'd agree with Knute: you have to bite the bullet and learn \shape.

But in the old stackexchange post, I'd be tempted to make the tie
unambiguous. The result is not publishable, but I don't think it
leaves room for doubt, even with no extra work, and it's \break-
able at either barline. (I'm assuming the lower e /is/ restruck
in measure two.)

Cheers,
David.



myTie.pdf
Description: Adobe PDF document
\version "2.24.2"
organUp = \relative c' {
\clef treble
\key e \minor
r2\mf
<< 
  { \voiceOne
  c4 d | e2( g)
  } 
  \new Voice { \voiceTwo
  s2 | s2 e
  }
  \new Voice { \voiceThree % ties (actually slurs) between staves
  s2 \stemDown \slurDown b2( \change Staff = "down" \voiceOne b4) \change Staff = "up" s4 % 2
  }
>>
}

organDown = \relative c' {
\clef bass
\key e \minor
<< 
  { \voiceOne
  r4 b2 a4 | g2 s4 a
  }
  \new Voice { \voiceTwo
  e1 ~ | e4 d c2
  }
>>
}
\score {
  \new PianoStaff \with { midiInstrument = #"church organ" } <<
\new Staff = "up" \organUp
\new Staff = "down" \organDown
  >>
  \layout { }
}