Re: Automatically centering markup along an arrow

2020-07-20 Thread Thomas Morley
Am Mo., 20. Juli 2020 um 04:13 Uhr schrieb Sam Bivens :
>
> Hi Harm,
> I won't be using this with broken slurs; these will all be small, 
> individualized segments of about five measures maximum.
> Sam

Hi Sam,

ok, for now every part of a broken Slur will get text then.

I implemented some changes (examples):
To get outside-staff-Slurs use \override Slur.details.outside-staff = ##t
To get text attached use \override Slur.details.attach = "Slur"
Text-Slur-distance is adjustable with \override
Slur.details.slur-text-distance = 1

Furthermore, to avoid collisions of the attached Text with other stuff
I changed the default skyline to:
  \override Slur.vertical-skylines =
#grob::unpure-vertical-skylines-from-stencil
Alas expensive, I don't see another possibility.

Cheers,
  Harm
\version "2.19.84"

%#(ly:set-option 'debug-skylines #t)

\include "arrow-slur-06.ly"

%% Text may be attached by using \tweak or \override

{
  \arrowed-slur

  c'1
 -\tweak details.attach "first Slur"
 ^(
  c')
  
  \once \override Slur.details.attach = \markup \box "2nd Slur"
  c'1 _(
  c')
}

\version "2.19.82"

%% Thanks to Aaron Hill
%% http://lists.gnu.org/archive/html/lilypond-user/2019-04/msg00240.html 

  
#(ly:load "bezier-tools.scm")

#(define (note-column-bounded? dir grob)
"Checks wether @var{grob} is a spanner and whether the spanner is bounded in
@var{dir}-direction by a note-column."
  (if (ly:spanner? grob)
  (grob::has-interface (ly:spanner-bound grob dir) 'note-column-interface)
  #f))

#(define (offset-number-pair-list l1 l2)
"Offset the number-pairs of @var{l1} by the matching number-pairs of @var{l2}"
;; NB no type-checking or checking for equal lengths is done here
  (map (lambda (p1 p2) (offset-add p1 p2)) l1 l2))

#(define (bezier::point control-points t)
"Given a Bezier curve of arbitrary degree specified by @var{control-points},
compute the point at the specified position @var{t}."
  (if (< 1 (length control-points))
  (let ((q0 (bezier::point (drop-right control-points 1) t))
(q1 (bezier::point (drop control-points 1) t)))
(cons
  (+ (* (car q0) (- 1 t)) (* (car q1) t))
  (+ (* (cdr q0) (- 1 t)) (* (cdr q1) t
  (car control-points)))

#(define (bezier::angle control-points t)
"Given a Bezier curve of arbitrary degree specified by @var{control-points},
compute the slope at the specified position @var{t}."
  (let ((q0 (bezier::point (drop-right control-points 1) t))
(q1 (bezier::point (drop control-points 1) t)))
(ly:angle (- (car q1) (car q0)) (- (cdr q1) (cdr q0)

#(define* 
  (bezier::approx-control-points-to-length 
control-points dir length 
#:optional (precision 0.01) (right-t 0.2) (left-t 0.8))
"Given a Bezier curve specified by @var{control-points}, return 
new control-points where the length of the Bezier specified by them is approx
@var{length}.
The procedure returns if difference of the new calculated length and the given
@var{length} is lower than optional @var{precision}.
The optional @var{left-t} and @var{right-t} represent the steps where new
control-points are calculated relying on @var{dir}."
  ;; TODO
  ;; Do the values for precision, left-t, right-t cover all cases?
  (let*  ((frst-cp (car control-points))
  (last-cp (last control-points))
  (actual-length
(ly:length 
  (- (car frst-cp) (car last-cp))
  (- (cdr frst-cp) (cdr last-cp
  (diff (- (abs actual-length) (abs length
  (if (< diff precision)
  control-points
  (bezier::approx-control-points-to-length
(if (positive? dir)
(cdr (split-bezier control-points right-t))
(car (split-bezier control-points left-t)))
dir
length

#(define (bezier::adjusted-arrow-head dir control-points)
(lambda (curve)
"Returns a stencil build from an arrowhead-glyph, adjusted to fit at start/end
of a curve looking at the curve's @var{control-points}.
Relying on @var{dir} for looking at left or right side of the curve."
  (if (not dir)
  empty-stencil
  (let* ((staff-space (ly:staff-symbol-staff-space curve))
 ;; reducing fs-from-staff-space a bit looks nicer
 (fs-from-staff-space (1- (magnification->font-size staff-space)))
 (grob-font
   (ly:paper-get-font
 (ly:grob-layout curve)
 `(((font-encoding . fetaMusic)
(font-size . ,fs-from-staff-space)
 (arrowhead-stil
   (ly:font-get-glyph grob-font
 (format #f "arrowheads.open.0~a1"
   (if (positive? dir) "" "M"
 (arrowhead-width 
   (interval-length (ly:stencil-extent arrowhead-stil X)))
 (offset-stil
   (ly:stencil-translate
 arrowhead-stil
 (cons (* dir 0.4 arrowhead-width) 0)))
 (arrowhead-end 

Re: Tie suicide location

2020-07-20 Thread Thomas Morley
Hi Andrew,

did it help?

Cheers,
  Har,

Am So., 19. Juli 2020 um 11:12 Uhr schrieb Thomas Morley
:
>
> Am So., 19. Juli 2020 um 10:38 Uhr schrieb Kevin Barry :
> >
> > On Sun, 2020-07-19 at 18:08 +1000, Andrew Bernard wrote:
> > > What is this error really about? Is there any way to perform a
> > > textual
> > > search to pin it down?
> >
> > The error occurs when LilyPond tries to find the points to attach a tie
> > to and can't find a notehead. The two situations in which this might
> > occur would be:
> > - you've removed the noteheads
> > - the tie spans 3 or more systems (each system will have a part of the
> > tie, but since there are only notes at the beginning and the end, the
> > system in the middle has a tie with no noteheads)
> >
> > Kevin
>
> Hi Kavin, Andrew,
>
> I don't think the first mentioned case happens here, at least
> { \omit NoteHead b1~ b }
> returns
> lilypond: /home/hermann/lilypond-git/build/../flower/include/interval.hh:256:
> T Interval_t::center() const [with T = double]: Assertion
> `!is_empty ()' failed.
> Aborted (core dumped)
> Not the problem Andrew reported.
>
> For the second case below may help:
>
> foo =
>   \override Tie.after-line-breaking =
>   #(lambda (grob)
> ;; For a dead Tie return the measure number and moment within
> the measure
> ;; of the starting point. Additionally color the remaining parts red.
> (let* ((orig (ly:grob-original grob))
>  (siblings (if (ly:grob? orig) (ly:spanner-broken-into orig) '()))
>  (dead-tie
>(if (pair? siblings)
>(remove grob::is-live? siblings)
>'(
>   (if (pair? dead-tie)
>   (begin
> (format #t
>   "\n\tThe broken Tie starting here: ~a has a dead part.\n"
>   (grob::rhythmic-location (ly:spanner-bound orig LEFT)))
> (map
>   (lambda (tie) (ly:grob-set-property! tie 'color red))
>   siblings)
>
> \layout {
>   \context {
>   \Voice
>   \remove "Forbid_line_break_engraver"
>   }
> }
>
> \new Staff
> <<
>   { \foo b1~ b b1*2~ b1 }
>   { s1 \break s1 s1 \break s1 \break s1 }
> >>
>
> If you already have some procedure set to Tie.after-line-breaking, it
> will get disturbed ofcourse.
>
> HTH,
>   Harm



Re: Arguments before functions

2020-07-20 Thread Fr. Samuel Springuel
> On 19 Jul, 2020, at 4:32 PM, David Kastrup  wrote:
> 
> I don't see that you can fix this with a music function,

That’s what I thought, I just wanted to make sure.

> but of course
> you can process the complete music expression and then modify any note
> before a \bar "|".

I hadn’t thought of that, but since it would still involve modifications to the 
source (to add the function which modifies the whole source) I figure I’m 
probably better off with functions that only affect the notes I’m interested in 
changing in the long run.

> On 19 Jul, 2020, at 4:43 PM, Aaron Hill  wrote:
> 
> Rather than try to work around the plumbing of LilyPond, might I suggest the 
> following:
> 
> 
> ...
> 
> 
> This approach allows you to create a template of sorts for individual notes.  
> Above is an example usage to aid with pointing, supporting the middle of a 
> phrase and the final tone.

Interesting approach.  My idea was to define functions which apply the 
transformations directly and then have place holder functions in the music 
which are defined using \etc:



\version "2.20.0"

episema = #(define-music-function (note-event) (ly:music?)
   "Add an tenuto ArticulationEvent to the articulations of 
`note-event',
which is supposed to be a NoteEvent expression.  This simulates 
the 
episema."
   (set! (ly:music-property note-event 'articulations)
 (cons (make-music 'ArticulationEvent
   'articulation-type "tenuto")
 (ly:music-property note-event 'articulations)))
   note-event)

dotted = #(define-music-function (note) (ly:music?)
  "Add a dot to the duration of note."
  (withMusicProperty 'duration (ly:make-duration 2 1) note)
  )

final = \dotted \etc
middle = \episema \etc

\fixed c' { \cadenzaOn a4 g \middle b g8[ f] g4_( \final c') \bar "|” }




In this case switching what appears in the music is a matter of changing the 
definitions of the aliases.

I think both approaches accomplish the job, so it’s probably a matter of taste 
as to which to choose.  Yours does have the distinct advantage of making more 
use of LilyPond syntax and is more compact as a result.

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Re: ly:pitch-alteration

2020-07-20 Thread Adam Good
Hans,
If I'm not mistaken turkish-makam.ly is currently only in the development
release? Or is that not the case?
Sorry it's not easy for me to check, I'm out of town and only on an OSX
64-bit machine.

Adam

On Fri, Jul 17, 2020 at 4:13 PM Hans Åberg  wrote:

>
> > On 17 Jul 2020, at 22:02, Freeman Gilmore 
> wrote:
> >
> > Using ly:pitch-alteration with makam.ly, if I play {ck}, how would i
> > use ly:pitch-alteration to see the alteration inside makam.ly?
>
> Adam Good has made new file called turkish-makam.ly, which is in the
> distribution.
>
>


Re: pitch-alteration

2020-07-20 Thread Carl Sorensen
I can confirm that it is not in 2.20.0 on MacOS.

Carl


From: lilypond-user  
on behalf of Adam Good 
Date: Monday, July 20, 2020 at 12:37 PM
To: Hans Åberg 
Cc: Lilypond-User Mailing List 
Subject: Re: ly:pitch-alteration

Hans,
If I'm not mistaken turkish-makam.ly is currently only 
in the development release? Or is that not the case?
Sorry it's not easy for me to check, I'm out of town and only on an OSX 64-bit 
machine.

Adam

On Fri, Jul 17, 2020 at 4:13 PM Hans Åberg 
mailto:haber...@telia.com>> wrote:

> On 17 Jul 2020, at 22:02, Freeman Gilmore 
> mailto:freeman.gilm...@gmail.com>> wrote:
>
> Using ly:pitch-alteration with makam.ly, if I play {ck}, how 
> would i
> use ly:pitch-alteration to see the alteration inside 
> makam.ly?

Adam Good has made new file called turkish-makam.ly, 
which is in the distribution.


Re: ly:pitch-alteration

2020-07-20 Thread Hans Åberg



> On 20 Jul 2020, at 20:36, Adam Good  wrote:
> 
> If I'm not mistaken turkish-makam.ly is currently only in the development 
> release? Or is that not the case?
> Sorry it's not easy for me to check, I'm out of town and only on an OSX 
> 64-bit machine.

I have on MacPorts of MacOS 10.15:
  /opt/local/share/lilypond/2.21.2/ly/turkish-makam.ly

You might try the installer I made, which does not require MacPorts, though 
made from it.


> On 20 Jul 2020, at 20:40, Carl Sorensen  wrote:
> 
> I can confirm that it is not in 2.20.0 on MacOS.

Was 2.20 made from 2.19 or 2.18?






Re: Automatically centering markup along an arrow

2020-07-20 Thread Sam Bivens
Thanks, Harm, this is incredible! (And I learned a new grob that I'd never
seen before.) When I put this question out I didn't intend to just have one
guy do all of the work, but it's very much appreciated!
Sam


Re: Automatically centering markup along an arrow

2020-07-20 Thread Thomas Morley
Am Mo., 20. Juli 2020 um 22:41 Uhr schrieb Sam Bivens :
>
> Thanks, Harm, this is incredible! (And I learned a new grob that I'd never 
> seen before.)

A new grob? Which one?

> When I put this question out I didn't intend to just have one guy do all of 
> the work,

As already said, Aaron improved the original code heavily...

> but it's very much appreciated!

Glad I could help.

Cheers,
  Harm



Re: ly:pitch-alteration

2020-07-20 Thread Freeman Gilmore
This is where I got ly:pitch-alteration. from, but I do not know how
to use it:
http://x31eq.com/lilypond/

The Pitch Model

Pitches in Lilypond are a combination of the position on the staff,
and the alteration relative to the nominal at that position, as a
rational fraction of a 200 cent whole tone. Pitch names repeat every
1200 cent octave. You can create a pitch with ly:make-pitch and find
out about an existing pitch with ly:pitch-octave, ly:pitch-notename,
andly:pitch-alteration.There's also
ly:pitch-steps, which is a combination of ly:pitch-octave and
ly:pitch-notename, and ly:pitch-semitones which can be risky in a
microtonal context.

Thank you, ƒg


On Mon, Jul 20, 2020 at 3:07 PM Hans Åberg  wrote:
>
>
>
> > On 20 Jul 2020, at 20:36, Adam Good  wrote:
> >
> > If I'm not mistaken turkish-makam.ly is currently only in the development 
> > release? Or is that not the case?
> > Sorry it's not easy for me to check, I'm out of town and only on an OSX 
> > 64-bit machine.
>
> I have on MacPorts of MacOS 10.15:
>   /opt/local/share/lilypond/2.21.2/ly/turkish-makam.ly
>
> You might try the installer I made, which does not require MacPorts, though 
> made from it.
>
>
> > On 20 Jul 2020, at 20:40, Carl Sorensen  wrote:
> >
> > I can confirm that it is not in 2.20.0 on MacOS.
>
> Was 2.20 made from 2.19 or 2.18?
>
>
>