Re: Including only definitions from a Lilypond file

2020-08-23 Thread Jérôme Plût
> On 2020-08-14 4:48 am, David Kastrup wrote:
> > All of the elements in a score are routed through hooks you can
> > redefine.  So you can just redefine your various hooks to do nothing and
> > then include the file.
> 
> Would something like this work?
> 
> 
> \version "2.20.0"
> 
> #(begin
>   (use-modules (ice-9 regex))
>   (let* ((symbols
>(map (lambda (m) (string->symbol (match:substring m 1)))
> (list-matches "define ([a-z-]+-handler)"
>   (ly:gulp-file "declarations-init.ly"
>  (procs (map primitive-eval symbols))
>  (null-proc (lambda args #f)))
> (ly:parser-define! 'disableHandlers
>   (define-void-function () ()
> (for-each
>   (lambda (sym) (primitive-eval `(set! ,sym ,null-proc)))
>   symbols)))
> (ly:parser-define! 'restoreHandlers
>   (define-void-function () ()
> (for-each
>   (lambda (sym proc) (primitive-eval `(set! ,sym ,proc)))
>   symbols procs)

This mostly works (except that I only needed to replace
"toplevel-.*-handler" functions), thanks!

Now I would like to use this to programmatically include a given file,
e.g. defining a Scheme function #(my-function "filename.ly") that would do
something equivalent to

#(compute something with "filename.ly")
\include "filename.ly"
#(compute something else with "filename.ly")

I tried to call (ly:parser-include-string (string-concatenate
`("\\disableHandlers \\include \"" ,filename "\""))) inside
my-function, but this produces
"fatal error: call-after-session used after session start".
(Some variants using ly:parser-parse-string, current-parser,
ly:parser-clone did not fare better).

Currently I see one (poor man's) way of doing that, which is calling

lilypond -e '(include "myfile.scm")' filename.ly

where "myfile.scm" does the first part of computation and sets up one
of the toplevel-.*-handler functions to do the second part of the
computation. (I've not tried it yet, though!). However this is quite
inelegant and, in particular:
 - likely not too robust w.r.t the content of "filename.ly",
 - does not allow including more than one file in sequence.

Is there a better way of doing this?

Thanks,

-- 
Jérôme Plût



Re: Fingering: showing strings by dots?

2020-08-23 Thread Pierre Perol-Schneider
Sure Harm, here you go: https://www.youtube.com/watch?v=YND32HckZqk=1m24s
Cheers,
Pierre

Le dim. 23 août 2020 à 11:02, Thomas Morley  a
écrit :

> Am So., 23. Aug. 2020 um 10:52 Uhr schrieb Pierre Perol-Schneider
> :
> >
> > Dear Andrew,
> >
> > Le dim. 23 août 2020 à 08:09, Andrew Bernard 
> a écrit :
> >
> >> I play bass gamba - I've always wanted to do the lovely curved beams
> >> (and for Bach,. and the lot!). No chance lilypond will ever be able to,
> >> I don't think!
> >
> >
> > I saw Harm (T. Morley) making a short presentation (no details) of
> curved beams few months ago (in german).
> > So, yes, it's possible...
> >
> > Cheers,
> > Pierre
> >
> >
>
> Could you post the link?
> I don't remember lol
>
> Cheers,
>   Harm
>


Re: Inheritance of MIDI settings into embedded contexts?

2020-08-23 Thread Dr. Thomas Tensi

Dear all,


thanks for the explanations!

I understand the pragmatics behind the decision to have the dynamic
performer at the voice context, because of the possible usage for
parallel and independent instruments.

But I am still not convinced: as Maurits has pointed out, nothing in the
syntax suggests that parallel voices do _not_ inherit settings from outside.

If you look at the pdf output of the example, there is only a fortissimo
mark at the beginning of the measure and no other dynamic mark.  Any
real performer (!) would not stop at the voices and say "oh, now there
are parallel voices, I should drop back to default volume".  But
lilyponds MIDI output does.

Nevertheless I shall implement Aaron's suggestion: it works great for my
needs, thanks for your effort!


Best regards,

Thomas



Re: Fingering: showing strings by dots?

2020-08-23 Thread Thomas Morley
Am So., 23. Aug. 2020 um 10:52 Uhr schrieb Pierre Perol-Schneider
:
>
> Dear Andrew,
>
> Le dim. 23 août 2020 à 08:09, Andrew Bernard  a 
> écrit :
>
>> I play bass gamba - I've always wanted to do the lovely curved beams
>> (and for Bach,. and the lot!). No chance lilypond will ever be able to,
>> I don't think!
>
>
> I saw Harm (T. Morley) making a short presentation (no details) of curved 
> beams few months ago (in german).
> So, yes, it's possible...
>
> Cheers,
> Pierre
>
>

Could you post the link?
I don't remember lol

Cheers,
  Harm



Re: Fingering: showing strings by dots?

2020-08-23 Thread Pierre Perol-Schneider
Dear Andrew,

Le dim. 23 août 2020 à 08:09, Andrew Bernard  a
écrit :

I play bass gamba - I've always wanted to do the lovely curved beams
> (and for Bach,. and the lot!). No chance lilypond will ever be able to,
> I don't think!
>

I saw Harm (T. Morley) making a short presentation (no details) of curved
beams few months ago (in german).
So, yes, it's possible...

Cheers,
Pierre


Re: Fingering: showing strings by dots?

2020-08-23 Thread Pierre Perol-Schneider
Le dim. 23 août 2020 à 07:56, Andrew Bernard  a
écrit :

> Hi Pierre,
>
> Bass gamba in France has very detailed markups, such as poussez (p) and
> tirez (t), push and pull (up and down bow), and a whole swag more. I'll
> dig up some Marin Marais and send to you.
>

Thank you Andrew.


Re: Fingering: showing strings by dots?

2020-08-23 Thread Pierre Perol-Schneider
Thank you for the examples.

Le dim. 23 août 2020 à 07:59, Alasdair McAndrew  a écrit :


> There are other issues with this music, which can bristle with expressive
> marks: bowing and fingering information, various shorthands for different
> sorts of ornaments, over and above the placement of the notes.  But I'll
> write another post about that.  For the fingering maybe I could possibly
> also use the markup command to place some characters atop each other, a
> digit and a row of closely spaced dots.  You'll see that although I
> mentioned in my original post that the dots are in an arc, that's not
> necessarily the case, and I could probably get away with a straight line.
>

See:
http://lilypond.org/doc/v2.19/Documentation/notation/other.fr.html#index-_005cpattern-1
E.g.:

\markup \pattern #4 #X #.2 \musicglyph #"dots.dot"

Cheers,
Pierre


Re: Placing text marks next to a note?

2020-08-23 Thread Andrew Bernard

Here:

http://lilypondblog.org/2013/08/adding-ornamentations-to-note-heads-part-1/


Andrew





Re: Placing text marks next to a note?

2020-08-23 Thread Andrew Bernard

Hello Alasdair,

Sooner or later you should grapple with doing these gamba signs 
properly. There's some articles by Nicolas Sceaux on the lilypond blog 
on how to go about it.


http://lilypondblog.org

I could give a hand if you so require.


Andrew


On 23/08/2020 5:31 pm, Alasdair McAndrew wrote:
I have created a small markup command for an ornament, which appears 
in engraved music of its time as a small "x", meaning a lower 
mordent.  Another common ornament would be written as a sort of large 
comma, and this meant a trill, starting on the upper note, and 
increasing in speed.  This is for late 17th and early 18th century 
French music for the viola da gamba.


The point is that these ornaments should go next to the notes to which 
they refer, and not necessarily above or below the staff.   This 
little example of a few bars indicate some of the difficulties, taken 
from the 4th book of "Pièces de Violes" by Marin Marais, published in 
Paris in 1717:






Re: Placing text marks next to a note?

2020-08-23 Thread Jean Brefort
Hi Alasdair,

You might start from the attached file provided by Nicolas Sceaux. I
did not test recently but with a previous version I had to play with
the code to add space when a mordent just follows a bar line. I used it
to edit the gamba part of Morel's chaconne a few years ago. I am not
currently at home and I don't have a sample code at hand.

Hope this helps,
Jean

Le dimanche 23 août 2020 à 17:31 +1000, Alasdair McAndrew a écrit :
> I have created a small markup command for an ornament, which appears
> in engraved music of its time as a small "x", meaning a lower
> mordent.  Another common ornament would be written as a sort of large
> comma, and this meant a trill, starting on the upper note, and
> increasing in speed.  This is for late 17th and early 18th century
> French music for the viola da gamba.
> 
> The point is that these ornaments should go next to the notes to
> which they refer, and not necessarily above or below the staff. 
>  This little example of a few bars indicate some of the difficulties,
> taken from the 4th book of "Pièces de Violes" by Marin Marais,
> published in Paris in 1717:
> 
> 
> 
> You'll see various bowing marks (actually there's only one used here:
> "e", which stands for the French "enfler": "swelling"; that is, a
> bow-stroke without the customary "attack"), x's and commas for
> ornaments, numbers with dots indicating fingers and which string, and
> next to the double-stopped d and f-sharp in the third and final bars
> what looks like a broken cross; this is a "barre", indicating a
> single finger laid over two or more strings at once.  
> 
> What I'm trying to do is to retain as much as possible of this
> notation in Lilypond.  I could probably bodge up quite a lot of this
> if there was some way of placing expressions next to the notes
> themselves - but I can't find out how to do that.  
> 
> Any advice would be gratefully received!
> 
> Thank you very much,
> Alasdair
> 

\version "2.20.0"

%%%
%%% Utilities for defining new grobs, grob properties and music event types
%%% (there should be built-in commands to do that in LilyPond)
%%%
#(define (define-grob-definition grob-name grob-entry)
   "Define a new grob and add it to `all-grob-definitions', after
scm/define-grobs.scm fashion.
After grob definitions are added, use:
\\layout {
  \\context {
\\Global
\\grobdescriptions #all-grob-descriptions
  }
}
to register them."
   (let* ((meta-entry   (assoc-get 'meta grob-entry))
  (class(assoc-get 'class meta-entry))
  (ifaces-entry (assoc-get 'interfaces meta-entry)))
 (set-object-property! grob-name 'translation-type? ly:grob-properties?)
 (set-object-property! grob-name 'is-grob? #t)
 (set! ifaces-entry (append (case class
  ((Item) '(item-interface))
  ((Spanner) '(spanner-interface))
  ((Paper_column) '((item-interface
 paper-column-interface)))
  ((System) '((system-interface
   spanner-interface)))
  (else '(unknown-interface)))
ifaces-entry))
 (set! ifaces-entry (uniq-list (sort ifaces-entry symbol

Re: Inheritance of MIDI settings into embedded contexts?

2020-08-23 Thread Maurits Lamers
Hi,

It might be here that the Lilypond syntax leads you up the proverbial garden 
path.
While voices are contexts within the scope of a staff, they are not nested 
within each other.
So, whenever a new voice is created, it is created equal to the other voices 
and consequently has only the Staff as a parent context.

Musically it makes a lot of sense to have the Dynamic_performer in the Voice 
context by default: most polyphonic uses of the Voice context are related to 
having two instruments or voices/vocals on a single staff, where each has their 
own dynamic signs. Only in keyboard music both voices will be performed by one 
performer and consequently most of the dynamics should be "inherited". In that 
case, it is more logical to move the Dynamic performer to the Staff context.

cheers

Maurits



> Op 22 aug. 2020, om 23:46 heeft Dr. Thomas Tensi  het 
> volgende geschreven:
> 
> Hello Aaron,
> 
> 
> thanks for the quick and detailed answer!
> 
> You wrote:
> > The Dynamic_performer is part of the Voice context; and the
> > construct << ... \\ ... >> implicitly creates new Voice contexts.
> 
> That is what I had assumed: the voice context _initializes_ its dynamics
> to the default value regardless of any outer contexts (that have no
> dynamic performer, by the way).
> 
> > [...]
> > \consisting the Dynamic_performer to the Staff (and \removing it
> > from the Voice) should apply the current logic to the wider scope
> 
> This sounds logical.
> 
> But what I do not get is why the contexts do not nest. A staff should
> have a dynamic performer that is _inherited_ by explicit and implicit
> voices within that staff.  The settings from the outer (staff) context
> are taken over unless the inner context (voice) changes some setting.
> The scope of this change is, of course, the inner context.
> 
> The same logic applies to variables in scoped programming languages:
> inner definitions shadow outer definitions, but if there is no inner
> definition, the outer definition is visible.
> 
> Hence: in my opinion the dynamics should be a setting that may be
> overridden in embedded contexts; if not, it retains the outer setting.
> 
> 
>   Best regards,
> 
>   Thomas
> 




Re: Fingering: showing strings by dots?

2020-08-23 Thread Andrew Bernard

Hi Alasdair,

I play bass gamba - I've always wanted to do the lovely curved beams 
(and for Bach,. and the lot!). No chance lilypond will ever be able to, 
I don't think!


Andrew