Re: Tweak beam slashes for small staves

2018-07-22 Thread Thomas Morley
2018-07-22 6:30 GMT+02:00 Edward Neeman :
> Hello,
>
> This snippet produces very nice slashed grace note beams: 
> http://lsr.di.unimi.it/LSR/Snippet?id=721
>
> However the slashes don’t adjust properly for smaller staves that are tweaked 
> with the \magnifyStaff function. In the example below, the slash on the 
> second (smaller) staff is too high and too long. How might I change the 
> function to accommodate the \magnifyStaff value?
>
> Thanks,
> Edward
>
> \version "2.19.80"
>
> slash =
> #(define-music-function (ang stem-fraction protrusion)
>(number? number? number?)
>(remove-grace-property 'Voice 'Stem 'direction) ; necessary?
>#{
>  \once \override Stem #'stencil =
>  #(lambda (grob)
>(let* ((X-parent (ly:grob-parent grob X))
>   (is-rest? (ly:grob? (ly:grob-object X-parent 'rest
>  (if is-rest?
>  empty-stencil
>  (let* ((ang (degrees->radians ang))
> ; We need the beam and its slope so that slash will
> ; extend uniformly past the stem and the beam
> (beam (ly:grob-object grob 'beam))
> (beam-X-pos (ly:grob-property beam 'X-positions))
> (beam-Y-pos (ly:grob-property beam 'positions))
> (beam-slope (/ (- (cdr beam-Y-pos) (car beam-Y-pos))
>(- (cdr beam-X-pos) (car beam-X-pos
> (beam-angle (atan beam-slope))
> (stem-Y-ext (ly:grob-extent grob grob Y))
> ; Stem.length is expressed in half staff-spaces
> (stem-length (/ (ly:grob-property grob 'length) 2.0))
> (dir (ly:grob-property grob 'direction))
> ; if stem points up. car represents segment of stem
> ; closest to notehead; if down, cdr does
> (stem-ref (if (= dir 1) (car stem-Y-ext) (cdr 
> stem-Y-ext)))
> (stem-segment (* stem-length stem-fraction))
> ; Where does slash cross the stem?
> (slash-stem-Y (+ stem-ref (* dir stem-segment)))
> ; These are values for the portion of the slash that
> ; intersects the beamed group.
> (dx (/ (- stem-length stem-segment)
>(- (tan ang) (* dir beam-slope
> (dy (* (tan ang) dx))
> ; Now, we add in the wings
> (protrusion-dx (* (cos ang) protrusion))
> (protrusion-dy (* (sin ang) protrusion))
> (x1 (- protrusion-dx))
> (y1 (- slash-stem-Y (* dir protrusion-dy)))
> (x2 (+ dx protrusion-dx))
> (y2 (+ slash-stem-Y
>(* dir (+ dy protrusion-dy
> (th (ly:staff-symbol-line-thickness grob))
> (stil (ly:stem::print grob)))
>
>   (ly:stencil-add
> stil
> (make-line-stencil th x1 y1 x2 y2))
>#})
>
> slashI = {
>   \slash 50 0.6 1.0
> }
>
>   <<
>\new Staff { \grace { \slashI b''8[ c'''] } c'' }
>\new Staff \with { \magnifyStaff #2/3 } { \grace { \slashI b''8[ c'''] } 
> c'' }
>   >>
>
> ---
> Dr. Edward Neeman
> www.neemanpianoduo.com


Hi,

the LSR-snippet does not take the changed staff-space into account,
thus the calculations are wrong, if staff-space isn't default.
The used trigonomitrcs makes it even harder to debug: Simply applying
the changed staff-space to the found x1/2 y1/2 values will not
succeed.

Further more I was always dissatisfied, because no automatic slashed
beams were possible.

Over the years I repeatedly tried different approaches and erlier this
year I've finally found something more satisfying.

It overrides Beam not Stem.

No trogonometrics.

Several adjustments are possible by overriding sub-properties of
Beam.details. Here the defaults as overrides:
  %% defaults:
  %% \override Beam.details.attach-side = #'left
  %% \override Beam.details.stem-part = 1
  %% \override Beam.details.slash-gradient = 1/2
  %% \override Beam.details.slash-x-y-over-shoot = #'(0.3 . 0.8)
  %% \override Beam.details.slash-thickness = 0.1
They suited me well in an own project, though for Beams of 8th-notes
the slash may collide with the NoteHead.
I always found Stems of 8th-notes are too often at minimum size in
LilyPond in general. For adding a slash this means there is (too)
little space.
It's one of the TODOs: automatic adjust slash-placement depending on
the duration.
For the examples below I therefore used modified values.
The other TODO is 'attach-side 'right. Atm it's buggy, it is possible
to adjust the other details sub-properties to get a nice output, but
not out-of-the-box.


But here the code with your example, additionally I included the LSR-examples.



\version "2.19.82"

%% c/p

how to refer to partial first bar using edition-engraver

2018-07-22 Thread Mason Hock
I have a score beginning with an 8th note pickup and want to place a \mark 
above the first note using edition-engraver. Edition-engraver appears to 
consider the first complete bar to be bar "1" and the timing mark "2 0/4" 
places tweaks at the beginning of the second complete bar. Therefore, my 
instinct was to use "0 7/8" for the bar/beat timing, but nothing appeared 
whether I used \mark or \markup. Next I tried "0 0/4" and got the same result. 
Interestingly, "1 0/4" places a \markup above the first complete bar, which is 
what I expected, but it places \mark in two locations, over the first note and 
over the clef. Placing a \mark over the first complete bar directly in the 
music, as opposed to using edition-engraver, places it as expected.

What is the correct way to place an editionMod in a partial bar? Here is a 
minimal example of the resutls described above:

--
\version "2.21.0"

\include "oll-core/package.ily"
\loadPackage edition-engraver

\editionMod all 2 0/4 score.staff.Voice ->
\editionMod all 2 0/4 score.staff.Voice \f
\editionMod all 0 0/4 score.Score ^\markup { "markup1" }
\editionMod all 0 0/4 score.Score \mark "mark1"
\editionMod all 0 7/8 score.Score ^\markup { "markup2" }
\editionMod all 0 7/8 score.Score \mark "mark2"
\editionMod all 1 0/4 score.Score ^\markup { "markup3" }
\editionMod all 1 0/4 score.Score \mark "mark3"

\consistToContexts #edition-engraver Score.Staff.Voice
\addEdition all

\score {
  <<
  \new Staff \with { \editionID staff }
\relative c' {
  \partial 8 d8 |
  d4\mark "mark4" d d d |
  d d d d
}
  >>
  \layout {
indent = 18\mm
\context {
  \Score
  \editionID score
}
  }
}
--

Thanks,

Mason


signature.asc
Description: PGP signature
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Tweak beam slashes for small staves

2018-07-22 Thread Edward Neeman
Hello Harm,

I just started playing around with this but it’s obviously a huge improvement. 
Thanks a lot for nailing yet another one of my nagging Lilypond issues!

Best,
Edward
---
Dr. Edward Neeman
www.neemanpianoduo.com



> On 22 Jul 2018, at 8:04 pm, Thomas Morley  wrote:
> 
> 2018-07-22 6:30 GMT+02:00 Edward Neeman :
>> Hello,
>> 
>> This snippet produces very nice slashed grace note beams: 
>> http://lsr.di.unimi.it/LSR/Snippet?id=721
>> 
>> However the slashes don’t adjust properly for smaller staves that are 
>> tweaked with the \magnifyStaff function. In the example below, the slash on 
>> the second (smaller) staff is too high and too long. How might I change the 
>> function to accommodate the \magnifyStaff value?
>> 
>> Thanks,
>> Edward
>> 
>> \version "2.19.80"
>> 
>> slash =
>> #(define-music-function (ang stem-fraction protrusion)
>>   (number? number? number?)
>>   (remove-grace-property 'Voice 'Stem 'direction) ; necessary?
>>   #{
>> \once \override Stem #'stencil =
>> #(lambda (grob)
>>   (let* ((X-parent (ly:grob-parent grob X))
>>  (is-rest? (ly:grob? (ly:grob-object X-parent 'rest
>> (if is-rest?
>> empty-stencil
>> (let* ((ang (degrees->radians ang))
>>; We need the beam and its slope so that slash will
>>; extend uniformly past the stem and the beam
>>(beam (ly:grob-object grob 'beam))
>>(beam-X-pos (ly:grob-property beam 'X-positions))
>>(beam-Y-pos (ly:grob-property beam 'positions))
>>(beam-slope (/ (- (cdr beam-Y-pos) (car beam-Y-pos))
>>   (- (cdr beam-X-pos) (car beam-X-pos
>>(beam-angle (atan beam-slope))
>>(stem-Y-ext (ly:grob-extent grob grob Y))
>>; Stem.length is expressed in half staff-spaces
>>(stem-length (/ (ly:grob-property grob 'length) 2.0))
>>(dir (ly:grob-property grob 'direction))
>>; if stem points up. car represents segment of stem
>>; closest to notehead; if down, cdr does
>>(stem-ref (if (= dir 1) (car stem-Y-ext) (cdr 
>> stem-Y-ext)))
>>(stem-segment (* stem-length stem-fraction))
>>; Where does slash cross the stem?
>>(slash-stem-Y (+ stem-ref (* dir stem-segment)))
>>; These are values for the portion of the slash that
>>; intersects the beamed group.
>>(dx (/ (- stem-length stem-segment)
>>   (- (tan ang) (* dir beam-slope
>>(dy (* (tan ang) dx))
>>; Now, we add in the wings
>>(protrusion-dx (* (cos ang) protrusion))
>>(protrusion-dy (* (sin ang) protrusion))
>>(x1 (- protrusion-dx))
>>(y1 (- slash-stem-Y (* dir protrusion-dy)))
>>(x2 (+ dx protrusion-dx))
>>(y2 (+ slash-stem-Y
>>   (* dir (+ dy protrusion-dy
>>(th (ly:staff-symbol-line-thickness grob))
>>(stil (ly:stem::print grob)))
>> 
>>  (ly:stencil-add
>>stil
>>(make-line-stencil th x1 y1 x2 y2))
>>   #})
>> 
>> slashI = {
>>  \slash 50 0.6 1.0
>> }
>> 
>>  <<
>>   \new Staff { \grace { \slashI b''8[ c'''] } c'' }
>>   \new Staff \with { \magnifyStaff #2/3 } { \grace { \slashI b''8[ c'''] } 
>> c'' }
 
>> 
>> ---
>> Dr. Edward Neeman
>> www.neemanpianoduo.com
> 
> 
> Hi,
> 
> the LSR-snippet does not take the changed staff-space into account,
> thus the calculations are wrong, if staff-space isn't default.
> The used trigonomitrcs makes it even harder to debug: Simply applying
> the changed staff-space to the found x1/2 y1/2 values will not
> succeed.
> 
> Further more I was always dissatisfied, because no automatic slashed
> beams were possible.
> 
> Over the years I repeatedly tried different approaches and erlier this
> year I've finally found something more satisfying.
> 
> It overrides Beam not Stem.
> 
> No trogonometrics.
> 
> Several adjustments are possible by overriding sub-properties of
> Beam.details. Here the defaults as overrides:
>  %% defaults:
>  %% \override Beam.details.attach-side = #'left
>  %% \override Beam.details.stem-part = 1
>  %% \override Beam.details.slash-gradient = 1/2
>  %% \override Beam.details.slash-x-y-over-shoot = #'(0.3 . 0.8)
>  %% \override Beam.details.slash-thickness = 0.1
> They suited me well in an own project, though for Beams of 8th-notes
> the slash may collide with the NoteHead.
> I always found Stems of 8th-notes are too often at minimum size in
> LilyPond in general. For adding a slash this means there is (too)
> little space.
> It's one of the TODOs: auto

Re: Tweak beam slashes for small staves

2018-07-22 Thread Thomas Morley
2018-07-23 0:42 GMT+02:00 Edward Neeman :

> I just started playing around with this but it’s obviously a huge improvement.

I hope so :)
If you encounter bugs or missing features (apart from the already
mentioned TODOs) please report.

Cheers,
  Harm

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Attaching lyrics to intermittent vocals with polyphony

2018-07-22 Thread Christopher R. Maden
tl;dr: interrupted five-voice polyphony — how to attach lyrics, and 
still get proper polyphonic engraving, in 2.18.2?


I had a call-and-response arrangement with three response parts, and 
assigned lyrics to the responses like so:


  <<
{
  \new Voice = "response"
  s1*6 |
}
{
  <<
\context Voice = "resp_hi" {
  \voiceOne \transpose c c' { \autoBeamOff \melRespOne }
}
\context Voice = "harmony" {
  \voiceThree \autoBeamOff \harmRespOne
}
\context Voice = "response" {
  \voiceTwo \autoBeamOff \melRespOne
}
  >>
  % ...
}
  >>
  \context Lyrics = "response" {
\lyricsto "response" {
  \respOne
}
  }

This produced nicely-stemmed notes for the responses, and allowed me to 
attached lyrics across disparate polyphonic response sections.


However, I added two more responses, and voices past \VoiceFour are 
unrecognized.  When I use the default << \\ >> polyphony, the \context 
approach no longer works.  Using the built-in voice "1" (etc.) works 
when there’s only one uninterrupted instance of polyphony; however, it 
doesn’t carry across a break.  If I try to set \context on a voice, I 
get a single (chord-ish) note column, plus the warning:


Preprocessing graphical objects...
test.ly:22:3: warning: ignoring too many clashing note columns

(although the lyrics do work).

What’s the optimal approach here?

Three MWEs are attached: one with the old, working approach; the second 
with default polyphony and unaligned lyrics; the last with an attempt at 
Voice context, which generates an error.


Thanks,
crism
--
Chris Maden, text nerd
http://crism.maden.org/ >
Emperor Norton had the right idea.
\version "2.18.2"

\language "english"

\new Staff <<
  {
\new Voice = "response"
s1*3 |
  }
  {
<<
  \context Voice = "resp_hi" {
\voiceOne c''4 c'' c'' c''
  }
  \context Voice = "harmony" {
\voiceThree g'4 g' g' g'
  }
  \context Voice = "response" {
\voiceTwo c'4 c' c' c'
  }
>>
| R1 |
<<
  \context Voice = "resp_hi" {
\voiceOne c''4 c'' c'' c''
  }
  \context Voice = "harmony" {
\voiceThree g'4 g' g' g'
  }
  \context Voice = "response" {
\voiceTwo c'4 c' c' c'
  }
>>
\bar "|."
  }
  \new Lyrics {
\lyricsto "response" {
  One two three four,
  Five six sev’n eight.
}
  }
>>
\version "2.18.2"

\language "english"

\new Staff <<
  {
\new Voice = "response"
s1*3 |
  }
  {
<<
  { c''4 c'' c'' c'' }
  \\
  { c4 c c c }
  \\
  { g'4 g' g' g' }
  \\
  { g4 g g g }
  \\
  { c'4 c' c' c' }
>>
| R1 |
<<
  { c''4 c'' c'' c'' }
  \\
  { c4 c c c }
  \\
  { g'4 g' g' g' }
  \\
  { g4 g g g }
  \\
  { c'4 c' c' c' }
>>
\bar "|."
  }
  \new Lyrics {
\lyricsto "1" { % what to attach to?
  One two three four,
  Five six sev’n eight.
}
  }
>>
\version "2.18.2"

\language "english"

\new Staff <<
  {
\new Voice = "response"
s1*3 |
  }
  {
<<
  { c''4 c'' c'' c'' }
  \\
  { c4 c c c }
  \\
  { g'4 g' g' g' }
  \\
  { g4 g g g }
  \\
  % \context Voice = "response" { c'4 c' c' c' }
  { \context Voice = "response" { c'4 c' c' c' } }
>>
| R1 |
<<
  { c''4 c'' c'' c'' }
  \\
  { c4 c c c }
  \\
  { g'4 g' g' g' }
  \\
  { g4 g g g }
  \\
  \context Voice = "response" { c'4 c' c' c' }
>>
\bar "|."
  }
  \new Lyrics {
\lyricsto "response" {
  One two three four,
  Five six sev’n eight.
}
  }
>>
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Attaching lyrics to intermittent vocals with polyphony

2018-07-22 Thread Christopher R. Maden

On 07/22/2018 09:37 PM, Christopher R. Maden wrote:
tl;dr: interrupted five-voice polyphony — how to attach lyrics, and 
still get proper polyphonic engraving, in 2.18.2?


Naturally I found the (an?) answer after posting...

http://lilypond.org/doc/v2.18/Documentation/notation/multiple-voices#collision-resolution 
> gives a definition for voiceFive that does what I need.


I still wonder that there’s not a better way to persist a voice across 
an interruption; maybe one of the wizards here has a better suggestion.


Thanks,
crism
--
Chris Maden, text nerd
http://crism.maden.org/ >
Emperor Norton had the right idea.

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Windows/WSL textedit handling (was Re: Interactive PDF Link to Notes in Preview)

2018-07-22 Thread Federico Bruni




Il giorno gio 19 lug 2018 alle 22:15, Aaron Hill 
 ha scritto:

On 2018-07-19 10:10, Federico Bruni wrote:
I made a quick try now and not surprisingly (I'm not a Windows user) 
did not work.


This stuff is significantly advanced for the average Windows user.  
Also, I would consider my approach here more akin to a hack or 
kludge.  For posterity, I will reiterate that my configuration is 
very unusual and not representative of a typical Windows system.  
Unless you too are running LilyPond via WSL and wanting to launch 
Visual Studio Code, then do expect work on your side to adapt things 
for your needs.



- have you used a multistring for Classes\textedit key? Otherwise you
cannot put the two lines.


All strings are simple REG_SZ values.  I am not sure what you mean by 
"the two lines", so please clarify that so I can best advise.




I was confused by the text you pasted.
I've now found this:
https://stackoverflow.com/questions/389204/how-do-i-create-my-own-url-protocol-e-g-so

and I quickly managed to register the protocol.





- I guess that the CMD path to lilypond-invoke-editor is wrong (it
seems a Linux path). Should I use what PowerShell gcm finds for it?


It must be a Linux-centric path because I am using WSL to launch it.  
You could not use anything else.  And PowerShell's Get-Command will 
not return anything useful, as it has no vision into WSL.  (Someone 
probably has a PowerShell addon that addresses that.)




Ok, I see.

I'd like to try not to use WSL, if possible.
I'm working on it and I might be close, but I need some help with 
Scheme. I'll open a new thread...





___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user