Re: Find out denominator of current time signature

2017-01-12 Thread Thomas Weber

11.01.2017 um 18:46 schrieb Malte Meyn:

You can get the duration from the context property timeSignatureFraction
or baseMoment:

%
\version "2.19.53"

{
   \time 12/8
   \applyContext
   #(lambda (context)
  (display (ly:context-property
 context
 'baseMoment)))
 %'timeSignatureFraction)))
}
%

I don’t know how you can make a music function that uses this and
returns music. \applyContext #(lambda (context) (make-music …)) has no
visible output. But maybe it’s a start.




That's definitely going into the right direction - many thanks. I tried this:


\new Staff <<
  {
c'4 d'4 e'4 f'4
  }
  {
\applyContext
  #(lambda (context)
(make-music
  'SkipEvent
  'articulations
(list (make-music
  'AbsoluteDynamicEvent
  'text
  "ff"))
  'duration
(ly:make-duration 0 0 1 (cdr (ly:context-property
  context
  'timeSignatureFraction)
  }
>>


which is apparently valid, but the created skip event is not inserted into the 
music (which your reply already suggested).  I guess the problem boils down to 
how to get hold of the context without \applyContext.

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


Re: Find out denominator of current time signature

2017-01-11 Thread Malte Meyn


Am 11.01.2017 um 14:00 schrieb Thomas Weber:
> Dear all,
> 
> I wonder how I can create a duration that is so to say exactly one time
> signature denominator long (e.g. an eigth in 6/8, a quarter in 4/4
> etc.).  I thought something like this would work:

You can get the duration from the context property timeSignatureFraction
or baseMoment:

%
\version "2.19.53"

{
  \time 12/8
  \applyContext
  #(lambda (context)
 (display (ly:context-property
context
'baseMoment)))
%'timeSignatureFraction)))
}
%

I don’t know how you can make a music function that uses this and
returns music. \applyContext #(lambda (context) (make-music …)) has no
visible output. But maybe it’s a start.

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


Find out denominator of current time signature

2017-01-11 Thread Thomas Weber

Dear all,

I wonder how I can create a duration that is so to say exactly one time 
signature denominator long (e.g. an eigth in 6/8, a quarter in 4/4 etc.).  I 
thought something like this would work:

  #(make-music
  'SkipEvent
  'duration
  (ly:make-duration 0 0 1 (ly:moment-main-denominator ???))
  'articulations
  (list (make-music
  'AbsoluteDynamicEvent
  'text
  "ff")))

Lacking experience, I don't know whether ly:moment-main-denominator is the 
thing to go for here and if so, what argument to supply.

The background is automatic generation of Lilypond input code where it is 
non-trivial to find out the time signature for the code generator, so I hoped 
it would be possible to write out some Scheme code that will defer that task to 
Lilypond.

Many thanks
Thomas


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