(scheme-)engraver in 2.20/21

2020-09-24 Thread Jan-Peter Voigt
Hi all,

after some other very involving projects I can now refocus on lilypond :-)

I probably missed a change in 2.20/21. If I create a scheme-engraver the
"start-translation-timestep" slot is not called, if the "initialize"
slot has been called in this particular timestep. If this the intended
behaviour I appreciate it because it is consistent. The "start-trans.."
slot wasn't called before for instant voices, but for regular installed
contexts. So now I have to finish "initialize" of the engraver with
"start-trans..." in any case.

So my question is if this is intended and not likely to change?
Sorry, if I missed discussion about this!

I have a demo below, where you can see that "start-trans..." is not
called, if "initialize" has been called before in the same timestep.


Jan-Peter


\version "2.21.5"

#(define (show trans slot)
   (let ((port (current-error-port)))
 (display slot port)(display "\t" port)
 (display (ly:context-current-moment (ly:translator-context trans))
port)
 (newline port)))

eng =
#(make-engraver
  ((initialize trans)
   (show trans "* initialize"))
  ((start-translation-timestep trans)
   (show trans "> start-translation-"))
  ((process-music trans)
   (show trans "  process-music"))
  ((stop-translation-timestep trans)
   (show trans "< stop-translation-"))
  ((finalize trans)
   (show trans "! finalize   ")) )

\layout {
  \context {
\Voice
\consists #eng
  }
}

\relative { c''8 b bes a << { as g fis g } \\ { es e dis e } >> }







Re: (scheme-)engraver in 2.20/21

2020-09-24 Thread Jan-Peter Voigt
Am 24.09.20 um 13:40 schrieb Aaron Hill:
> On 2020-09-24 2:51 am, Jan-Peter Voigt wrote:
>> Hi all,
>>
>> after some other very involving projects I can now refocus on lilypond
>> :-)
>>
>> I probably missed a change in 2.20/21. If I create a scheme-engraver the
>> "start-translation-timestep" slot is not called, if the "initialize"
>> slot has been called in this particular timestep. If this the intended
>> behaviour I appreciate it because it is consistent. The "start-trans.."
>> slot wasn't called before for instant voices, but for regular installed
>> contexts. So now I have to finish "initialize" of the engraver with
>> "start-trans..." in any case.
>>
>> So my question is if this is intended and not likely to change?
>> Sorry, if I missed discussion about this!
>>
>> I have a demo below, where you can see that "start-trans..." is not
>> called, if "initialize" has been called before in the same timestep.
>
> It would seem that initialize/finalize are primarily concerned with the
> lifetime of the context whereas (start|stop)-translation-timestep deal
> with moving from one moment to the next in music.  As such I do not see
> these things as related, so what would be the reason for initialize to
> trump start-translation-timestep?



> I am curious more about the statement that start-translation-timestep
> was not "called before for instant voices, but for regular installed
> contexts".  Do you have a MWE that demonstrates this behavior?  Running
> the code you already provided against 2.18.2 and 2.19.55 (both via
> lilybin.com), and 2.20.0 locally show the call to
> start-translation-timestep after initialize for all three contexts.
>
>
> -- Aaron Hill
>

The problem occured with the edition-engraver addressing instant voices.
When I run my example with 2.19.84 the voice-contexts created by <<...>>
miss the start-trans..-slot, but it is called for the first voice and
moment.





Re: (scheme-)engraver in 2.20/21

2020-09-24 Thread Jan-Peter Voigt
Hi Dan,

Am 24.09.20 um 13:42 schrieb Dan Eble:
> On Sep 24, 2020, at 05:51, Jan-Peter Voigt  wrote:
>>
>> Hi all,
>>
>> after some other very involving projects I can now refocus on lilypond :-)
>>
>> I probably missed a change in 2.20/21. If I create a scheme-engraver the
>> "start-translation-timestep" slot is not called, if the "initialize"
>> slot has been called in this particular timestep. If this the intended
>> behaviour I appreciate it because it is consistent. The "start-trans.."
>> slot wasn't called before for instant voices, but for regular installed
>> contexts. So now I have to finish "initialize" of the engraver with
>> "start-trans..." in any case.
>>
>> So my question is if this is intended and not likely to change?
>> Sorry, if I missed discussion about this!
>
> This change was intended.

thank you!
I stumbled across this looking at the edition-engraver.
Even though Aaron's objection is not entirely unjustified, I prefer this
uniform behavior. That means, the last action of "initialize" is always
"start-trans...".

>
> https://gitlab.com/lilypond/lilypond/-/merge_requests/292
>
> specifically, commit fe9242659305dce587bd1fcdcc7b0ac62df25ad6
> —
> Dan
>




private ly:version?

2020-09-24 Thread Jan-Peter Voigt
Hi all,

I now have a use case for ly:version? documented in
http://lilypond.org/doc/v2.21/Documentation/usage/writing-code-to-support-multiple-versions

But the function is module-private in lily. The example on that page
does not compile and so doesn't any external file.

I can work around it with
#(define ly:version? (@@ (lily) ly:version?))

But I guess that is not intended?
I might change the define to define-public in 'scm/lily-library.scm'?

Jan-Peter




Re: (scheme-)engraver in 2.20/21

2020-09-24 Thread Jan-Peter Voigt
Am 24.09.20 um 16:28 schrieb Aaron Hill:
> I doubt this is the sort of thing convert-ly could patch, so the
> proposed change in behavior would break user-created engravers that
> expect to always get a pair of (start|stop)-translation-timestep calls. 
> As such, it makes far more sense that LilyPond automatically take care
> of invoking start-translation-timestep after initialize.
OK that sounds reasonable

> The argument for uniform behavior is sound, though one must be careful
> the behavior to which you are aligning is correct.  My vote is that
> "starts" and "stops" must always be paired.  If there were cases where
> "start" was not occurring, *that* is the faulty behavior to address.
I agree. For now I can live with the faulty but uniform behaviour, but a
change in that direction should be developed.



Re: music21

2020-10-14 Thread Jan-Peter Voigt



Am 13.09.20 um 22:57 schrieb Jean Abou Samra:
> The Net is a surprisingly vast place. Did you ever hit this link?
>
> http://web.mit.edu/music21/
>
> It's a Python library that, among musicological tasks, features
> import from a dozen of different file formats, including MusicXML,
> MIDI and ABC, as well as export to LilyPond.
>
> Performing the conversion seems to be as simple as
>
> from music21 import *
> converter.parse('/path/to/input.[ext]').write('lilypond',
> '/path/to/output.ly')
>
> I have been unsuccessfully trying to show `make check` output when
> using this converter…  See the dev/jas/test-music21-2 branch in case
> you're interested. Anyway, here is a simple ABC file:
>
> X:1
> T:Notes
> M:C
> L:1/4
> K:C
> C, D, E, F,|G, A, B, C|D E F G|A B c d|e f g a|b c' d' e'|f' g' a' b'|]
>
> Attached are four LilyPond files. Two of them are produced using abc2ly
> and music21. The remaining two are the result of processing music21
> MusicXML output via musicxml2ly and xml2ly.
>
> Neither option is perfect; the xml2ly route seems to do the best job
> though.
>
> I'm running out of time for LilyPond right now, but I wanted to
> mention this
> thing. Maybe we can make a good anything2ly converter out of it, possibly
> pairing its MusicXML support with xml2ly. Being a Python library makes it
> easy to include in Frescobaldi.
>
> Cheers,
> Jean -- in a puzzled state of mind.
>
Music21 is a great tool I had to use recently. MusicXML im- and export
is very good. The Lilypond-export should be improved and Lily-import
would need some preprocessing, but I am going to look at it.

Jan-Peter





Re: Export from LilyPond to MusicXML (Thomas Morley)

2021-10-08 Thread Jan-Peter Voigt
Hi all,

probably what I am writing now is not new to most of you. About a year
ago there was a discussion regarding the license of Lilypond, triggered
by Urs' question about the future of OLL. Again and again the
documentation was referred to, which says that Lilypond is a compiler
that translates the source code into a PDF. For God's sake, I don't want
to discuss the licensing consequences again, but I want to point out
that this representation is not exactly complete. In fact, each source
file is translated into a Lilypond internal executable, the execution of
which then generates the PDF. This architecture is representable in XML,
if it is possible at all, only with extensions to MEI or MusicXML. So
the goal should only be to implement the graphical representation
accordingly.
But this also means that structures that serve a better organization of
the lilypond source code will most likely be lost during export and
re-import.

Several solutions for the export have now been mentioned. Behind these
are three concepts, all of which have their justification:
1. convert source-based (python-ly accessible through frescobaldi).
2. lilypond internal generation of an intermediate code
3. scheme based generation of an intermediate code

If the sources comply, i.e. do not contain Scheme, then the python-ly
solution is quite charming, fast and batchable. But I would find the
internal generation of an intermediate code, as envisioned and developed
by Jacques, the nicest. The Scheme based solution I started from the
pragmatic consideration that if it works, it can be quickly adapted and
deployed in different environments.

I'm very glad to see this discussion revisited. Maybe something more can
be developed together in this direction. For this reason, I am also
pushing the discussion to the devel list. ;-)

I'll be on the road for the next week, but I plan to get back to the
topic after that.

Cheers,

Jan-Peter


Am 07.10.21 um 22:51 schrieb Thomas Morley:
> Am Do., 7. Okt. 2021 um 13:32 Uhr schrieb Jean Abou Samra 
> :
>>
>> Harm,
>>
>> Le 07/10/2021 à 11:46, Thomas Morley a écrit :
>>> Not sure Jan-Peter's approach is the best method ...
>>
>> What makes you think so?
>>
>> Best,
>> Jean
>
> Maybe my wording was misleading.
>
> I tested ly->musicxml with
> (1) openlilylib, i.e. Jan-Peter
> (2) python-ly
> (3) Frescobaldi
> (4) https://github.com/de-wolff/lilypond.git
>
> Then tried reimporting the resulting xml-file via
> (a) musicxml2ly
> (b) xml2ly
>
> All results were terrible. Here I stopped frustrated.
> I did not look into any code, thus I simply don't know which one is
> the most promising approach.
>
> Cheers,
>   Harm
>




Re: Export from LilyPond to MusicXML (Thomas Morley)

2021-10-08 Thread Jan-Peter Voigt



> Am 08.10.2021 um 12:04 schrieb David Kastrup :
> 
> Jan-Peter Voigt  writes:
> 
>> Hi all,
>> 
>> probably what I am writing now is not new to most of you. About a year
>> ago there was a discussion regarding the license of Lilypond, triggered
>> by Urs' question about the future of OLL. Again and again the
>> documentation was referred to, which says that Lilypond is a compiler
>> that translates the source code into a PDF. For God's sake, I don't want
>> to discuss the licensing consequences again, but I want to point out
>> that this representation is not exactly complete. In fact, each source
>> file is translated into a Lilypond internal executable, the execution of
>> which then generates the PDF.
> 
> Uh, no?  Calling LilyPond's internal representation of music an
> "executable" is nonsensical since it does not imply any actions but is a
> structural representation of music.
Ok, my designation as internal executable is certainly not a good picture.
My point is that this process is not a pure translation language A to language 
B.
Whatsoever, this is not the topic I want to discuss.
> There never is any linear
> representation being "executed", and source files are interpreted rather
> than compiled, with no file-level representation ever being explicit.
Well at least a (Scheme) Engraver can be used to instruct that a note head be
painted red if it is the third moment in the measure. Alternatively, this 
information
can be given to each affected notehead via override. The source file is 
interpreted,
as you write, and not compiled, as written in the documentation.
(https://lilypond.org/windows.html, https://lilypond.org/macos-x.html, 
https://lilypond.org/unix.html: "Compiling a file")
> That's not an academic difference since it is a non-trivial question
> just what the structure of a MusicXML file is supposed to represent from
> a given LilyPond input file.
Yes, that is essentially what I wanted to say.

Jan-Peter




Re: Binaries of LilyPond 2.23.5 with Guile 2.2

2021-12-05 Thread Jan-Peter Voigt
Hi Jonas,

your version works on my MXLinux Laptop. Tomorrow I am going to try
Ubuntu and MacOS Monterey on Apple Silicon.
Thanks for these works to you and all others engaged in this endeavor!

Jan-Peter

Am 03.12.21 um 19:17 schrieb Jonas Hahnfeld via Discussions on LilyPond
development:
> Hi all,
>
> here are the binaries of LilyPond 2.23.5 with Guile 2.2, created
> exactly with the scripts contained in the official source tar:
> https://gitlab.com/hahnjo/lilypond/-/packages/4049140
> (For now I've published them on my repo, but I can also add them to the
> official one and link it from the GitLab release if people think so.)
>
> "Installation" is quite simple:
> 1. Unpack the right archive for your OS (Linux, macOS, Windows).
> 2. Use it from any location you want, for example by setting PATH or
> just pointing Frescobaldi to bin/lilypond.
>
> Please give this some serious testing as this might become official at
> some point. I'd be especially grateful for testing on macOS (later than
> 10.14) since I don't have a system myself and cannot test outside of
> the MacStadium node that I used for building (but that obviously has
> stuff installed to compile LilyPond, so I might not have noticed if
> some library is missing...)
>
> Cheers
> Jonas




Re: Scheme in LilyPond

2017-06-01 Thread Jan-Peter Voigt

Hi Charles,

the make-note-ev function is hidden inside a closure and therefore not 
publicly visible. It depends on the duration defined in that closure. To 
create NoteEvents you should create them like this:


(make-music 'NoteEvent 'pitch root 'duration some-duration)

where 'some-duration' is defined with a duration: (ly:make-duration 2) 
for a quarter note.


The begin-define-sequence implies using 'let':

#(let ((root (ly:make-pitch 0 0 0))
   (dur (ly:make-duration 2)))
   (display (make-music 'NoteEvent 'pitch root 'duration dur)))

If there is a duration reachable in the scope you are acting, then you 
can use that one like you found in the mentioned file and probably copy 
the definition of make-note-ev.


HTH
Jan-Peter

Am 01.06.2017 um 17:03 schrieb Charles Winston:

Hi,

I’m fooling around with using Scheme in lilypond files, making some way on my 
GSoC chords project. I’m trying to call the make-note-ev procedure found in 
scm/chord-entry.scm on line 196. I’ve written something simple:

#(begin
(define root (ly:make-pitch 0 0 0))
(display (make-note-ev root))
)

And I get an error saying that make-note-ev is an unbound variable. I thought 
that we could call Scheme procedures from the source in lilypond files. What am 
I missing here?

Thanks,
Charles
___
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel




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


calc stem direction

2017-06-14 Thread Jan-Peter Voigt

Hi list,

in a scheme-engraver I want to get the stem-direction in the 
acknowledger-slot. When I use ly:stem::calc-direction the calculated 
direction is not always the visible one, when autobeaming is in effect. 
A manual beam crashes lily.


So my question is: How can I retrieve the actual/current stem direction?

TIA
Jan-Peter

% snip %
\version "2.19.62"

#(define-public (stem-direction-engraver context)
   (make-engraver
(acknowledgers
 ; store stem direction
 ((stem-interface engraver grob source-engraver)
  ; this function crashes, if a beam starts
  (ly:message "stem info ~A" (ly:stem::calc-direction grob))
  )
 )
))

\layout {
  \context {
\Voice
\consists #stem-direction-engraver
  }
}

\score {
  % the directions are not completely
  \relative { c''8 b bes a g f e d }
}

\score {
  % the function crashes with the beam-event
  \relative { c''8 b[ bes] a g f e d }
}

% /snip %




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


lilypond export

2017-06-14 Thread Jan-Peter Voigt

Hi list-members,

I have been working on an export module for lilypond. The last month 
there was no time to work on it. So I send you this link despite its 
pre-alpha state, because otherwise the project might fall asleep ;-)


https://github.com/jpvoigt/lilypond-export

It is designed as an openlilylib-plugin so you should clone it next to 
oll-core (if you want to try it) It comes with one example file that 
shows the core commands.


Now, if you import lilypond-export/package.ily you have a command and a 
context-mod in place to export music with or without typesetting it:


music = { ... }
\exportMusic \default xml \music

will export a MusicXML-file .xml in many cases. Well, it is in 
pre-alpha stage, but for example if you have a simple choir piece, it 
should produce a MusicXML-file that can be read by MuseScore.
The other exporter produces Humdrum, that can for example be tested at 
http://verovio.humdrum.org/


The exporter uses some engravers to collect all note-events and store 
them in a tree-structure. The exporter-modules then traverse the tree 
and writes the corresponding strings to the output file. Right now ties 
and slurs are not collected, but lyrics are exported to XML. Beams are 
watched and exported.


This is one first sketch how it should work. There is a lot to do to add 
basics, like ties and slurs, and to make it a stable export module that 
is able to handle complex scores. But I appreciate any feedback and 
maybe someone likes to collaborate?


Best
Jan-Peter

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


triggering translation from engraver

2017-08-23 Thread Jan-Peter Voigt

Hi developers,

I have difficulties to find the right words for this question, but I'll try:

The edition-engraver comes into action, when it finds a mod 
(tweak/override) for the current spot in time, that is measure/barNumber 
and moment/measurePosition. These mods are applied in one of the 
engravers slots, that is either (most times) in the 
start-translation-timestep, acknowledger, listener or the process-music 
function.
Now, if there is no stop/break in translation the function will not get 
called:

\editionMod target 1 1/8 Voice \override ...
will not get called if the music is something like
{ c'4 c' }
because after step 0/4 step 1/4 will get called, but not the 1/8 step.
(I hope you can follow)

There are two things I'd like to accomplish:
1. allow the edition-engraver to apply tweaks outside the regular 
"stops" of the music
2. add an offset to a mod and apply the tweak a given moment after the 
current time


To do that I would like to trigger/broadcast an event that forces the 
translator to stop again after a given moment has passed. The former 
example will work if I add some skips to the music:

<< { c'4 c' } { s8 s s s } >>

But in my tests broadcasting a skip-event didn't show the desired 
effect. Maybe I did something wrong or maybe this is the wrong way.


Do you have another idea how to do that?

TIA
Jan-Peter


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


Re: triggering translation from engraver

2017-08-23 Thread Jan-Peter Voigt
Hi David,

thank you for your work on this! I will try/investigate it later this evening 
or tomorrow in the morning.

Best
Jan-Peter

Am 23. August 2017 18:33:15 MESZ schrieb David Kastrup :
>David Kastrup  writes:
>
>> David Kastrup  writes:
>>
>>> Jan-Peter Voigt  writes:
>>>
>>>> Do you have another idea how to do that?
>>>
>>> Timing is established by iterators and they work on music
>expressions,
>>> not events.  So you need to have an iterator in the race from the
>start.
>>> Few iterators have variable length.  The sequential iterator can
>have an
>>> elements-callback delivering music expressions.  Those can have a
>>> structure and/or length determined at callback time.
>>>
>>> Kicking this into orderly operation does not seem like it would be
>>> reasonably workable.
>>>
>>> Iterators are not user-definable at the moment.  Either a general
>>> facility or a more specific "wait-iterator" would seem warranted.
>>
>> You might want to use \lyricsto to add your private control context
>to
>> the Score context.  When switching off everything that can track
>> melismata, you might get woken up once per event regardless of how
>long
>> your actual expressions are.
>>
>> But it might make more sense to work on actual infrastructure for
>this
>> rather than fudging around with existing facilities not intended for
>it.
>
>As an example: I've created a \waitFor music function that does
>something similar to what you want.  It was just quite useless in the
>original state since it waited for a particular expression, and you
>cannot use it to wait for \mark "B" when the mark has been generated
>with \mark \default .
>
>It turns out, looking at it, that the C++ code already does something
>more useful, namely taking the "procedure" callback for evaluating a
>triggering condition.  While the LilyPond code does not yet match the
>C++ code: so I probably gave up for some reason after noticing that
>this
>still wasn't what I could be using.
>
>So this definitely needs fleshing out into something more useful.  But
>it illustrates the kind of iterator you likely want to be using: I seem
>to remember that I was able to make the original version (before
>fudging
>the procedure callback into the C++ code) do something.

-- 
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.
___
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel


Re: triggering translation from engraver

2017-08-24 Thread Jan-Peter Voigt

Hi David,

I started an experimental build with the waitFor-iterator. Right now it 
does not do doing anything, but it is already helpful for studying. 
Perhaps an edition-iterator that reports the mod-events to the contexts 
would be good.
OTOH that is already done if a music expression is translated. If all 
mods are known before translation a SequentialMusic expression for each 
Context might be created and then added to the music.

... this is not thought to the end.

Jan-Peter

Am 23.08.2017 um 19:09 schrieb David Kastrup:

Jan-Peter Voigt  writes:


Hi David,

thank you for your work on this! I will try/investigate it later this
evening or tomorrow in the morning.


It's half-baked half-finished work.  I vaguely remember that I could not
figure out exactly how to make it do 100% of what I wanted it to do when
it happened to end up shelved.

But I guess as a starting point it's likely still a step forward from
having nothing.




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


TupletNumber.avoid-slur regression?

2017-10-19 Thread Jan-Peter Voigt

Hi developers,

I just stumbled over a regression 2.19.80. The following code works as 
expected in 2.18 but kills the beam in 2.19.80:


{
  \override TupletNumber.avoid-slur = #'outside
  \voiceOne \tuplet 3/2 { c''16[( b' a']) }
}

Or is there an undocumented change without a convert-ly rule?

Jan-Peter

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


Workaround for Issue 5001? (TupletNumber.avoid-slur)

2017-11-05 Thread Jan-Peter Voigt

Hi list,

I just ran into issue 5001 
(https://sourceforge.net/p/testlilyissues/issues/5001/)

Does anybody know about a workaround?

Jan-Peter

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


Re: Workaround for Issue 5001? (TupletNumber.avoid-slur)

2017-11-05 Thread Jan-Peter Voigt

Hello James,

thanks for pointing this out! The mentioned case also occurs in my 
current score, but most times I deal with a slur over three notes:


\version "2.19.49"

\relative c'' {
  \time 4/4
  % the default case
  \tuplet 3/2 {a8^( g a)}
  % the "avoid-slur"-bug
  \once \override TupletNumber.avoid-slur = #'outside
  \tuplet 3/2 {a8^( g a)}
  % this is, how it should look like, but unfortunately all have to
  % be set with trial and error for different notes
  \shape #'((0 . -2.1)(0 . -2.1)(0 . -2.1)(0 . -2.1)) Slur
  \once \override TupletNumber.Y-offset = #4.5
  \tuplet 3/2 {a8^( g a)}
}

Jan-Peter



Am 05.11.2017 um 14:52 schrieb James Lowe:

Hello,

On Sun, 5 Nov 2017 13:02:43 +0100, Jan-Peter Voigt  wrote:


Hi list,

I just ran into issue 5001
(https://sourceforge.net/p/testlilyissues/issues/5001/)
Does anybody know about a workaround?

Jan-Peter



Well the initial problem on the user list that caused tihs tracker says that 
they used padding

http://lists.gnu.org/archive/html/lilypond-user/2016-11/msg00633.html

Is that what you wanted?

James




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


Re: Workaround for Issue 5001? (TupletNumber.avoid-slur)

2017-11-05 Thread Jan-Peter Voigt

Hi Harm,

thanks alot, this is really helpful!

Cheers
Jan-Peter

Am 05.11.2017 um 16:28 schrieb Thomas Morley:

Hi Jan-Peter,

2017-11-05 15:44 GMT+01:00 Jan-Peter Voigt :

Hello James,

thanks for pointing this out! The mentioned case also occurs in my current
score, but most times I deal with a slur over three notes:

\version "2.19.49"

\relative c'' {
   \time 4/4
   % the default case
   \tuplet 3/2 {a8^( g a)}
   % the "avoid-slur"-bug
   \once \override TupletNumber.avoid-slur = #'outside


%% The bug seems to be not present for avoid-sur 'ignore
%% Hence you could workaround with less effort at the lines of:
   \once \override TupletNumber.avoid-slur = #'ignore
   %% probably take slur/tuplet-direction into account
   \once \override TupletNumber.Y-offset =
 #(lambda (grob) (+ (ly:tuplet-number::calc-y-offset grob) 1.1))


   \tuplet 3/2 {a8^( g a)}
   % this is, how it should look like, but unfortunately all have to
   % be set with trial and error for different notes
   \shape #'((0 . -2.1)(0 . -2.1)(0 . -2.1)(0 . -2.1)) Slur
   \once \override TupletNumber.Y-offset = #4.5
   \tuplet 3/2 {a8^( g a)}
}

Jan-Peter



Cheers,
   Harm




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


OLL-core and Win10 [was Re: edition-editor usage]

2017-12-26 Thread Jan-Peter Voigt

Hi Trevor,

I am working on Linux and have no Windows 10 running. I will try on Win7 
later. IIRC there was a problem with oll-core on Windows 10, but maybe 
someone else can tell?

The error message indicates a problem before EE is loaded.
If oll-core is loaded successfully EE *should* work.

Jan-Peter


Am 26.12.2017 um 09:41 schrieb Trevor:

Hi EE-Users

I thought I'd try to bring the edition engraver into use over the 
holiday period, so I cloned edition-engraver and oll-core from git-hub 
into a local repository, placed that in Frescobaldi's include path and 
tried to compile the first example in edition-engraver.  It fails with 
the message:


C:/Users/tdani/openlilylib/oll-core/package.ily:57:2 <0>: error: GUILE 
signaled an error for the expression beginning here


#

(if (not (defined? 'openlilylib-root))


C:/Users/tdani/AppData/Local/Temp/frescobaldi-u9vnw1qc/tmpuqjcysah/example-1.ly:35:1 
<1>: error: unknown escaped string: `\loadPackage'



\loadPackage edition-engraver

Before I spend time investigating this further, I'm wondering if the 
edition-engraver is known to work within Frescobaldi on Windows 10 with 
LilyPond 2.19.80.  Are there any such users?


Alternatively, any ideas what I might be doing wrong?

Trevor

------ Original Message --
From: "Jan-Peter Voigt" mailto:jp.vo...@gmx.de>>
To: lilypond-u...@gnu.org <mailto:lilypond-u...@gnu.org>; "Mason Hock" 
mailto:masonh...@gmail.com>>

Sent: 24/12/2017 10:19:48
Subject: Re: edition-editor usage


Hello Mason,

it is possible to use \shapeII with the edition-engraver :-)
And it sounds like this is the use case the EE is originally meant for.

Yes, the wording is a bit inconsistent and/or irritating. I will try 
to sum it up:
In the recent versions I used the terms target and context to divide 
two dimensions. The target names the requested output like for example 
'fullscore' or 'violinI-part'. If you "activate" an edition-target 
with \addEdition violinI-part it uses all modifications that look like
\editionMod violinI-part{ 
\shapeII ... }


This is a real example I used inside the piano reduction:
\editionMod klavier 38 0/8 chor.ten.TenorStaff \once \shapeII #'(()(0 
. 1)()()) Slur

It means:
with edition-target 'klavier' (the piano reduction) in measure 38 the 
first eighth apply the shapeII-command inside the context identified 
by 'chor.ten.TenorStaff'.
Moments are counted zero-based, so the first moment is zero. This 
might irritating on first sight, but it is meaningful as the distance 
from the beginning of the measure. The context in the example above is 
the tenor staff inside the choir-staff.


I think the main point is understanding the three dimensions:
1. the edition-target - that is the condition if to apply the 
modification ... apply this modification for the score of type T(arget)
2. the edition-context - that is where to apply the modification ... 
the LilyPond context like Voice, Staff, Score etc.
3. the time - that is the musical timestamp when to apply the 
modification ... moment X inside measure Y


HTH

I will send more details and information soon!
But for today and tomorrow I wish you a merry Christmas and all the 
best for 2018!


Jan-Peter


Am 23. Dezember 2017 20:09:29 MEZ schrieb Mason Hock 
:


I have a piece in which each performer reads from a version of the score
with their staff full-sized with the other parts on small staves. This
pieces also requires a lot of manual tweaking of slurs.

I've been using \shapeII for the slurs, which works great, except that
if I shape the slur correctly for the full-sized version of the part it
is shaped incorrectly for the small version of the part and vice versa.
In order for the slurs to look good in both situations I need two sets
of \shapeII tweaks.

edition-editor looks like a promising solution, but I'm having trouble
learning how to use it. The only documentation I can find is the usage
examples here.

https://github.com/openlilylib/edition-engraver/tree/master/usage-examples

Each example is very specific, which makes it difficult to decode how
edition-engraver works in general. I guess my questions are

(1) Will edition-engraver work for tweaking slurs with \shapeII?

(2) If so, what should be my approach in terms of organization? My guess
would be to have 8 editions, a full-size version and small version for
each of the 4 staves, where each pdf uses 1 full-size edition and 3
small editions.

(3) How do I make certain 'editions' (at this point I'm questioning
whether I'm using that term correctly) apply to certain staves in each pdf?

(4) What is the basic syntax for using edition-editor? It's difficult to
tell from the examples in the repo what is the basic syntax and what is
extending

broadcasting override-events (was [Re: Edition Engraver bug?])

2018-03-07 Thread Jan-Peter Voigt

Hi David and all,

I stuck with successfully sending override-events from an engraver. I 
created an example where I broadcast 3 events, one of them being an 
override, but the override is not applied while the other 2 events are 
processed as expected.
All events are sent using the same procedure. What might be the error in 
this procedure. Is there something missing?


TIA
Jan-Peter


Am 05.03.2018 um 13:01 schrieb Jan-Peter Voigt:

* I will refactor the EE to also broadcast overrides.


\version "2.19.80"

% this is a broadcast-function for single events like \p or c''4
#(define (broadcast-music context music)
   ; get attributes for this music expression
   (let ((evcls (ly:assoc-get (ly:music-property music 'name) music-descriptions '(
 ; log time and music
 (ly:message "~A ~A ~A"
   (ly:context-property context 'currentBarNumber)
   (ly:context-property context 'measurePosition)
   (with-output-to-string (lambda() (displayLilyMusic music
 ; broadcast event
 (ly:broadcast (ly:context-event-source context) ; broadcast to this context
   (ly:make-stream-event
(ly:assoc-get 'types evcls '()) ; get event class from attributes
(ly:music-mutable-properties music)) ; get properties for this music-event
   )
 ))

% 3 tests
evA = \p
evB = \once \override NoteHead.color = #red
evC = g'4

% a demo engraver
eng = #(make-engraver
((start-translation-timestep trans)
 (let ((context (ly:translator-context trans)))
   (cond
((equal? (ly:context-property context 'measurePosition) (ly:make-moment 1/4))
   (broadcast-music context evA)) ; on moment 1/4 broadcast \p
((equal? (ly:context-property context 'measurePosition) (ly:make-moment 2/4))
   (broadcast-music context evB)) ; on moment 2/4 broadcast \override ...
((equal? (ly:context-property context 'measurePosition) (ly:make-moment 3/4))
   (broadcast-music context evC)) ; on moment 3/4 broadcast g'4
   )))
)

\layout {
  ragged-right = ##f
  \context {
\Voice
\consists #eng
  }
}

% demo music
% Why are the overrides not applied?
\relative {
  \repeat unfold 3 { c''4 c^"p" c^"red?" c^"+g" }
}
___
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel


Re: broadcasting override-events (was [Re: Edition Engraver bug?])

2018-03-07 Thread Jan-Peter Voigt

Am 07.03.2018 um 11:25 schrieb David Kastrup:

Check the source code in lily/property-iterator.cc to see what to
generate here for the various events (Push/Pop correspond to
override/revert).


Thank you David! This allows me to refactor the code.

Jan-Peter

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


Re: broadcasting override-events (was [Re: Edition Engraver bug?])

2018-03-07 Thread Jan-Peter Voigt

Am 07.03.2018 um 15:30 schrieb David Kastrup:

Jan-Peter Voigt  writes:


Am 07.03.2018 um 11:25 schrieb David Kastrup:

Check the source code in lily/property-iterator.cc to see what to
generate here for the various events (Push/Pop correspond to
override/revert).


Thank you David! This allows me to refactor the code.


Actually, Push/Pop correspond to "temporary override/revert".  A normal
override is translated into Pop+Push in sequence if I remember
correctly.

yep, and I will repair the handling of _not_ \temporary \overrides. 
Right now EE handles all overrides as temporary.


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


crash running translator

2018-09-17 Thread Jan-Peter Voigt
Dear all,

I stumbled over something that looks like a bug.
If one uses ly:run-translator to process some music a dotted rest
crashes lilypond:

\version "2.19.82"
#(ly:run-translator #{ r2. #} #{ \layout {} #})

The error message is:
Wrong number of arguments to #

Does anybody know a way to circumvent this?

Jan-Peter

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


Re: crash running translator

2018-09-17 Thread Jan-Peter Voigt
Hi David,

wow, thank you!
I will try to follow your explanations soon and read the mentioned code.

Jan-Peter


Am 17.09.2018 um 16:38 schrieb David Kastrup:
> Jan-Peter Voigt  writes:
> 
>> Dear all,
>>
>> I stumbled over something that looks like a bug.
>> If one uses ly:run-translator to process some music a dotted rest
>> crashes lilypond:
>>
>> \version "2.19.82"
>> #(ly:run-translator #{ r2. #} #{ \layout {} #})
>>
>> The error message is:
>> Wrong number of arguments to #
>>
>> Does anybody know a way to circumvent this?
> 
> Well, looking up the definition of ly:run-translator I read:
> 
> LY_DEFINE (ly_run_translator, "ly:run-translator",
>2, 1, 0, (SCM mus, SCM output_def),
>"Process @var{mus} according to @var{output-def}.  An"
>" interpretation context is set up, and @var{mus} is"
>" interpreted with it.  The context is returned in its"
>" final state.\n"
>"\n"
>"Optionally, this routine takes an object-key to"
>" to uniquely identify the score block containing it.")
> [...]
> 
> Which makes me barf.  The final paragraph is just gobbledygook.  It
> doesn't help that this mysterious optional object-key is _accepted_ but
> the function signature does not even contain a parameter declaration for
> it.
> 
> Ok, onward.  Running with -dverbose I get
> 
> -*- mode: compilation; default-directory: "/tmp/" -*-
> Compilation started at Mon Sep 17 15:45:07
> 
> lilypond -dverbose gok.ly
> GNU LilyPond 2.21.0
> ]
> ]
> ]
> ]
> ]
> [... we should probably do something about those, dozens more]
> Processing `gok.ly'
> Parsing...
> Interpreting music...Backtrace:
> In unknown file:
>?:  0* [lilypond-main ("gok.ly")]
> In /usr/local/share/lilypond/2.21.0/scm/lily.scm:
> 1032:  1* (let* ((failed #)) (if (ly:get-option #) (begin #)) ...)
> 1032:  2* [lilypond-all ("gok.ly")]
> 1045:  3  (let* ((failed #) (separate-logs #) (ping-log #) ...) (gc) ...)
> 1057:  4* [for-each # ("gok.ly")]
> In unknown file:
>?:  5* [# "gok.ly"]
> In /usr/local/share/lilypond/2.21.0/scm/lily.scm:
> 1059:  6* (let* (# # #) (if separate-logs #) (if ping-log #) ...)
> 1070:  7* [lilypond-file # "gok.ly"]
> 1105:  8  [catch ly-file-failed # #]
> In unknown file:
>?:  9* [#]
> In /usr/local/share/lilypond/2.21.0/scm/lily.scm:
> 1106: 10* [ly:parse-file "gok.ly"]
> In gok.ly:
>Now it's getting interesting:
> 
>2: 11* [ly:run-translator # #]
> In unknown file:
>?: 12* [# #]
>?: 13* [# # #]
>?: 14* [# # # Rest > ...]
>?: 15* [ly:rest::width #]
>?: 16* [lookup-font # ((# # # #) (# # # # ...) ())]
> 
> ERROR: In procedure lookup-font:
> ERROR: Wrong number of arguments to # alist-chain)>
> 
> Compilation exited abnormally with code 1 at Mon Sep 17 15:45:08
> 
> Ok, so we have
> SCM
> Rest::width (SCM smob)
> {
>   return generic_extent_callback (unsmob (smob), X_AXIS);
> }
> 
> and
> 
> Rest::generic_extent_callback (Grob *me, Axis a)
> {
>   /*
> Don't want ledgers: ledgers depend on Y position, which depends on
> rest collision, which depends on stem size which depends on beam
> slop of opposite note column.
> 
> consequence: we get too small extents and potential collisions
> with ledgered rests.
>   */
>   SCM m = brew_internal_stencil (me, a != X_AXIS);
>   return ly_interval2scm (unsmob (m)->extent (a));
> }
> 
> and
> 
> Rest::brew_internal_stencil (Grob *me, bool ledgered)
> {
>   SCM durlog_scm = me->get_property ("duration-log");
>   if (!scm_is_number (durlog_scm))
> return Stencil ().smobbed_copy ();
> 
>   int durlog = scm_to_int (durlog_scm);
> 
>   string style = robust_symbol2string (me->get_property ("style"), "default");
> 
>   Font_metric *fm = Font_interface::get_default_font (me);
>   string font_char = glyph_name (me, durlog, style, ledgered, 0.0);
>   Stencil out = fm->find_by_name (font_char);
>   if (out.is_empty ())
> me->warning (_f ("rest `%s' not found", font_char.c_str ()));
> 
>   return out.smobbed_copy ();
> }
> 
> 
> Actually, looking at the traceback it would seem like lookup-font is not
> actually called with the wrong number of arguments but something is
> confused by the first argument being *undefined*.  Which is a value that
> usually is used in the C API for signifying

Re: Export to MusicXML

2018-10-16 Thread Jan-Peter Voigt
Hello Alex,

you don't have to apologize for this question! It comes up every now and
then, but has not been answered satisfyingly yet. My answers to your
questions are:
1. Yes
2. I wrote a rudimentary engraver-based solution last year which is
waiting for clean-up and completion to support MEI, MusicXML, Humdrum,
LilyPond (!) and any other format for which an export-module with a
defined API exists.
https://github.com/jpvoigt/lilypond-export/

The code in the project is able to export a MusicXML-File for a simple
lilypond-score. The resulting files are not always correct/functional so
this is more sketch of the idea. The base is an engraver that fetches
and collects events and on score-finalization calls the specified export
module with this (normalized) music collection.
The collection is some scheme-structure, but should probably be better a
normal LilyPond music-expression.

Just a little piece of something ;-)
HTH
Jan-Peter


Am 16.10.2018 um 06:49 schrieb Alex Roitman:
> Hello,
> 
> I apologize in advance if this was already asked and answered on this list.  
> I’m looking into exporting some of my lilypond music into the MusicXML 
> format. All I could find so far was the python-ly package that attempts to 
> translate ly files into MusicXML.  It has some issues that could be fixed, 
> and some that I don’t think could be so easily fixed, e.g. whether or not to 
> place accidentals, beams, and so on.
> 
> It seems to me that the nature of the MusicXML format is such that in can 
> only be correctly written when the music is interpreted in context.  Which is 
> what lilypond does.  So I’m guessing that the right way to go about this is 
> to create a new Translator, alongside Performer and Engraver, that instead of 
> midi/graphical objects just dumps XML.
> 
> Finally, here are my questions:
> 1. Does this seem like a right approach?
> 2. Was this ever attempted and is there any work left that one can continue?
> 
> Thanks in advance for any help!
> Alex
> 
> 
> ___
> lilypond-devel mailing list
> lilypond-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/lilypond-devel
> 


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


Re: Export to MusicXML

2018-10-16 Thread Jan-Peter Voigt
Hi Alex,

you're very welcome! And I'm always open for questions and discussions
about the code. For general questions you should use the list so that
others can join or at least follow the discussion. (I think Urs said so
already). If we get to the point where direct communication is
reasonable we can also exchange jabber, skype, slack or signal contacts.

Jan-Peter




Am 16.10.18 um 20:13 schrieb Alex Roitman:
> Thank you Jan-Peter!  This looks really promising, and I’d love to contribute.
> 
> I’m only vaguely familiar with Scheme so I’ll probably take a bit of time to 
> get my hands dirty with that.  Would it be OK to bug you with questions every 
> now and then? Is this list a good place, or should I just email you 
> privately?  I promise I won’t abuse your kindness :-)
> 
> Alex
> 
>> On Oct 16, 2018, at 2:04 AM, Jan-Peter Voigt  wrote:
>>
>> Hello Alex,
>>
>> you don't have to apologize for this question! It comes up every now and
>> then, but has not been answered satisfyingly yet. My answers to your
>> questions are:
>> 1. Yes
>> 2. I wrote a rudimentary engraver-based solution last year which is
>> waiting for clean-up and completion to support MEI, MusicXML, Humdrum,
>> LilyPond (!) and any other format for which an export-module with a
>> defined API exists.
>> https://github.com/jpvoigt/lilypond-export/
>>
>> The code in the project is able to export a MusicXML-File for a simple
>> lilypond-score. The resulting files are not always correct/functional so
>> this is more sketch of the idea. The base is an engraver that fetches
>> and collects events and on score-finalization calls the specified export
>> module with this (normalized) music collection.
>> The collection is some scheme-structure, but should probably be better a
>> normal LilyPond music-expression.
>>
>> Just a little piece of something ;-)
>> HTH
>> Jan-Peter
>>
>>
>> Am 16.10.2018 um 06:49 schrieb Alex Roitman:
>>> Hello,
>>>
>>> I apologize in advance if this was already asked and answered on this list. 
>>>  I’m looking into exporting some of my lilypond music into the MusicXML 
>>> format. All I could find so far was the python-ly package that attempts to 
>>> translate ly files into MusicXML.  It has some issues that could be fixed, 
>>> and some that I don’t think could be so easily fixed, e.g. whether or not 
>>> to place accidentals, beams, and so on.
>>>
>>> It seems to me that the nature of the MusicXML format is such that in can 
>>> only be correctly written when the music is interpreted in context.  Which 
>>> is what lilypond does.  So I’m guessing that the right way to go about this 
>>> is to create a new Translator, alongside Performer and Engraver, that 
>>> instead of midi/graphical objects just dumps XML.
>>>
>>> Finally, here are my questions:
>>> 1. Does this seem like a right approach?
>>> 2. Was this ever attempted and is there any work left that one can continue?
>>>
>>> Thanks in advance for any help!
>>> Alex
>>>
>>>

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


Re: Export to MusicXML

2018-10-16 Thread Jan-Peter Voigt
... by the way: what is the current state of guile2 in lilypond?
I recently noticed some mails on the list.

Jan-Peter

Am 16.10.18 um 17:32 schrieb David Kastrup:
> Paul Morris  writes:
> 
>> For Google Summer of Code 2015 David Garfinkle worked on MusicXML export.
>>
>> (See mailing list archives:
>> https://lists.gnu.org/archive/cgi-bin/namazu.cgi?query=Garfinkle&submit=Search%21&idxname=lilypond-devel&max=20&result=normal&sort=score
>> )
>>
>> I don't know if the code he wrote was ever checked in somewhere, on a
>> branch or something.  (It's not mentioned in the issue for this
>> feature.)  I have a copy of it somewhere that he sent me, but I'd
>> assume that Jan-Peter's work on this would be the better place to
>> start / collaborate.
> 
> I posted it a few times on the mailing list, having acted as the mentor.
> One problem is that it will be of best utility once Guile-2 (and the
> respective XML libraries) are in use, and it's more a technological
> starting point than a result-oriented one.  Of course, the ultimate goal
> is the same.
> 


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


Re: Export to MusicXML

2018-10-16 Thread Jan-Peter Voigt
Hi Kieren,


Am 16.10.18 um 16:54 schrieb Kieren MacMillan:
> Hi Jan-Peter,
> 
>> 2. I wrote a rudimentary engraver-based solution last year which is
>> waiting for clean-up and completion to support MEI, MusicXML
> 
>> The code in the project is able to export a MusicXML-File for a simple
>> lilypond-score. The resulting files are not always correct/functional so
>> this is more sketch of the idea. The base is an engraver that fetches
>> and collects events and on score-finalization calls the specified export
>> module with this (normalized) music collection.
>> The collection is some scheme-structure, but should probably be better a
>> normal LilyPond music-expression.
> 
> 1. Why would it be "better" as a normal Lilypond music-expression?
hm, did I misorder my words? Now I think it maybe be better to store the
music in plain lilypond expressions e.g. SequentialMusic. Right now the
music is stored in an alist by measure and moment. That way the exporter
can easily iterate over the measures and moments and place the events in
the resulting export format, but my intuition says that it might be
better if the exporter modules rely on something lilypond can reuse
itself directly. In other words: I think it would be better *not* to
create another structure.
But it is just something to have in mind and to consider while
developing further.

> 2. Is it currently in a state where someone with limited Scheme chops, but 
> good XML chops, could take the MusicXML portion to the goal line? 
Right now it is a sketch of an idea, so it might or might not fulfill
anyones needs:

1. it is incomplete in that it doesn't translate all elements.
2. the MusicXML is created "manually" with simple string-concatenation.
That is not a problem if the resulting file is correct, but ...
3. some files are incorrect and cannot be loaded by MuseScore

It would be very helpful to have an XML-lib at hand for the export. I
started a simple function that takes an alist structure end writes it as
XML. But I am hesitant to really use that because if it is injected it
might stop the integration of the standard libs when they are available.

Jan-Peter

> 
> Thanks,
> Kieren.
> 
> 
> Kieren MacMillan, composer
> ‣ website: www.kierenmacmillan.info
> ‣ email: i...@kierenmacmillan.info
> 


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


Re: guilev1/2 musing

2019-01-25 Thread Jan-Peter Voigt
Hi there,

just a few words on my work on musicxml export:
There is an openlilylib project that provides an export command. It is based on 
an engraver that collects all events and builds an abstract structure that can 
be serialized by an export module. One of them writes MusicXML. Alex Roitman 
did a lot of work on it recently.
The functions to build XML are copied from guile 2 so they can be easily 
adapted if they are included in a guile 1 fork or via guile 2.
The idea is to provide an export infrastructure that can be modified to add an 
export block like layout and midi are.
OTOH this project is based on the need to export files with the current used 
lily version.

Jan-Peter

Am 25. Januar 2019 16:43:55 MEZ schrieb David Kastrup :
>Paul Morris  writes:
>
>> On 1/24/19 3:08 PM, Thomas Morley wrote:
>>
>>>  From my point of view (and limited knowledge) other newly
>implemented
>>> guilev2-procedures are not _that_ important.
>>
>> One area where guile2 (and upcoming guile3) would be useful is for
>> MusicXML export.  David Garfinkle's summer of code project (mentored
>> by David Kastrup) made a start on using guile2's sxml and pattern
>> matching procedures (which aren't in guile1)
>
>They exist as Guile1 library, it's just that they are by default in
>Guile2.  If we decided prepackaging Guile1 was the way to go, including
>the respective library version should be feasible as well.
>
>No guarantees, but that was my impression.
>
>> to convert LilyPond's internal music data structures into MusicXML
>> output.
>
>> Since guile2 appears to work well enough at this point, aside from
>> performance, would it be worth setting up a "guile2 and musicxml
>> export" branch where we could land David Garfinkle's code and enable
>> further work on MusicXML export?  It seems like a guile2 branch
>> already exists to some extent?
>
>Not really, and I don't think it makes sense to commit functionality to
>Guile2-only at this moment.
>
>> Then at some future point... either LilyPond moves to a future guile
>> or we back-port the guile2 procedures to guile1.
>
>"some future point" is just going to cause additional work.  We don't
>really have the personnel to do non-essential/non-trivial work on two
>separate implementations.
>
>> (Jan-Peter Voigt has also done separate work on MusicXML export, but
>> my sense is that in the long run, the approach in the summer of code
>> project would be preferable.)
>
>I haven't looked at Jan-Peter's approach.  David Garfinkle's code is
>mostly in the state of a solid first sketch, so a distribution-viable
>production-ready code is still quite a bit of work away.  Without
>anybody committed to take it considerably further, making decisions
>based on its existence would seem to be a bit premature.  Like with
>many
>open ends, this is more or less the "who decides to invest significant
>work gets to decide on the approach".  There is not much of a point in
>planning out in detail what nobody will pick up.
>
>> Thanks for the insights into the guile1/2 situation and what's
>causing
>> the performance hit.
>
>-- 
>David Kastrup
>
>___
>lilypond-devel mailing list
>lilypond-devel@gnu.org
>https://lists.gnu.org/mailman/listinfo/lilypond-devel

-- 
Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.
___
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel


Re: guilev1/2 musing

2019-01-26 Thread Jan-Peter Voigt
Hi Paul,

sorry for missing to mention your contribs! And thank you for the XML port.

I didn't look into the gsoc code lately, but perhaps the two projects dont need 
to compete?

I hope I can focus on my lily projects the next weeks.

Jan-Peter 

Am 26. Januar 2019 18:18:48 MEZ schrieb Paul Morris :
>On 1/25/19 10:43 AM, David Kastrup wrote:
>
>> Paul Morris  writes:
>>> One area where guile2 (and upcoming guile3) would be useful is for
>>> MusicXML export.  David Garfinkle's summer of code project (mentored
>>> by David Kastrup) made a start on using guile2's sxml and pattern
>>> matching procedures (which aren't in guile1)
>> They exist as Guile1 library, it's just that they are by default in
>> Guile2.  If we decided prepackaging Guile1 was the way to go,
>including
>> the respective library version should be feasible as well.
>>
>> No guarantees, but that was my impression.
>
>
>Ah, good to know they exist as guile1 libraries.  (I just assumed that 
>since guile2 was used for the gsoc project, that they didn't exist for 
>guile1.)
>
>Does anyone know where to locate them?  I did some searching and came
>up 
>short.  They are "Pattern Matching (ice-9 match)" and "SXML" modules in
>
>the current guile2: 
>https://www.gnu.org/software/guile/manual/html_node/Guile-Modules.html
>
>
>>> Since guile2 appears to work well enough at this point, aside from
>>> performance, would it be worth setting up a "guile2 and musicxml
>>> export" branch where we could land David Garfinkle's code and enable
>>> further work on MusicXML export?  It seems like a guile2 branch
>>> already exists to some extent?
>> Not really, and I don't think it makes sense to commit functionality
>to
>> Guile2-only at this moment.
>
>
>Okay, and since the needed libraries exist for guile1, then work on 
>(that approach to) musicxml export doesn't need to be blocked waiting
>on 
>guile2.
>
>>> Then at some future point... either LilyPond moves to a future guile
>>> or we back-port the guile2 procedures to guile1.
>> "some future point" is just going to cause additional work.  We don't
>> really have the personnel to do non-essential/non-trivial work on two
>> separate implementations.
>
>Makes sense, and sounds like we don't need to wait for guile2 anyway.
>
>>> (Jan-Peter Voigt has also done separate work on MusicXML export, but
>>> my sense is that in the long run, the approach in the summer of code
>>> project would be preferable.)
>> I haven't looked at Jan-Peter's approach.  David Garfinkle's code is
>> mostly in the state of a solid first sketch, so a distribution-viable
>> production-ready code is still quite a bit of work away.  Without
>> anybody committed to take it considerably further, making decisions
>> based on its existence would seem to be a bit premature.  Like with
>many
>> open ends, this is more or less the "who decides to invest
>significant
>> work gets to decide on the approach".  There is not much of a point
>in
>> planning out in detail what nobody will pick up.
>
>
>Indeed, although, I've contributed a bit to Jan-Peter's code for this, 
>and would like to contribute more (as time allows) to see this feature 
>added to LilyPond.  But I've wondered which approach would make more 
>sense for eventual landing in LilyPond.  More consensus about the 
>approach, could encourage contributions by removing such questions.
>
>Cheers,
>-Paul
>
>
>___
>lilypond-devel mailing list
>lilypond-devel@gnu.org
>https://lists.gnu.org/mailman/listinfo/lilypond-devel

-- 
Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.
___
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel


Re: Poster for music engraving conference

2019-12-05 Thread Jan-Peter Voigt
Hi Werner, hi Bernhard, and especially Urs ;-),

what about using a LaTeX a0poster-template together with lyluatex? That
would make collaboration with GIT straightforward.
A quick search brought up these templates:
https://www.cfd.tu-berlin.de/~panek/tex/poster/poster.html
http://www.latextemplates.com/cat/conference-posters

Though, the template(s) need some adaption to work with lualatex.

Even though my schedule is quite tight I would like to contribute.
I have obtained the permission from two publishers to use single
excerpts/pictures from the St.Mark passion (Ortus Berlin, I will talk
about it) and a contemporary score composed by Hermann Keller (Edition
Juliane Klein Berlin).

Jan-Peter


Am 04.12.19 um 12:05 schrieb Werner LEMBERG:
>
> Folks,
>
>
> the music engraving conference in Salzburg (January 17.-19.) aims to
> present as much note engraving programs as possible.  While some
> companies send representatives (e.g., Dorico, Capella, Finale) – some
> even with talks – we don't have something similar for LilyPond in the
> main part of the conference.
>
> Instead, we would like to have a poster (in A0 format) that shows how
> LilyPond works, together with some showcase results.
>
> Now my question: Are there people who are willing to produce such a
> poster?  Has anyone already done something similar for other
> conferences?
>
>
> Werner
>




Re: Poster for music engraving conference

2020-01-10 Thread Jan-Peter Voigt
Hello Fellows,

in December Werner asked for a poster for the conference. Did somebody
actually produce something?
The last days I tried something based on the baposter-LaTeX-class.
I'll not be able to finish the poster on my own until monday ... , but
if you'd like to collaborate on this topic or you have a poster, I can
donate some content to, please let me know!

Jan-Peter


Am 04.12.19 um 12:05 schrieb Werner LEMBERG:
>
> Folks,
>
>
> the music engraving conference in Salzburg (January 17.-19.) aims to
> present as much note engraving programs as possible.  While some
> companies send representatives (e.g., Dorico, Capella, Finale) – some
> even with talks – we don't have something similar for LilyPond in the
> main part of the conference.
>
> Instead, we would like to have a poster (in A0 format) that shows how
> LilyPond works, together with some showcase results.
>
> Now my question: Are there people who are willing to produce such a
> poster?  Has anyone already done something similar for other
> conferences?
>
>
> Werner
>




Re: Context paths (and the Edition Engraver)

2020-01-21 Thread Jan-Peter Voigt
Hi there,

> [Single-level quotes are David Kastrup’s; double-level quotes are Dan Eble’s.]
>
>> Comments from the EE crowd?
>
> Not sure how much of a "crowd" we are…  ;)
at least we are 2 :)


>>> One of the things in Kieren's intro to the Edition Engraver (EE) that 
>>> resonated with me was the context paths.
> […]
>>> The ability to refer to contexts this way is a great idea, though IMHO it 
>>> needs some work to reduce ambiguity.
>
> I agree on both points. (Perhaps one of my first contributions in 2020 should 
> be a less-ambiguous set of documented examples for the EE?)
that would of course be helpful, because my examples will always along
my development ideas and not along a foreign users view ...

>>>  \context along.Voice.B { ... }
>>>  \set along.Voice.B.property = #...
>>>  \change Voice = ChoirStaff.A.Staff.B
>
> An interesting proposal.
I'd like that, though it would be a quite invasive change.
And if we stay with the string for the context id and then use
lists/paths in the \context statement like
\new Staff = "choir" << \new Voice = "soprano" …

and then use
\context Voice = choir.soprano

it would be inconsistent with \new  = "…"

I will write down some more text about this topic later.

>> I think that this would warrant closely analysing what the EE does and
>> checking whether its way of specifying things is a natural match to what
>> might be useful with LilyPond, or at least can be made so without
>> impacting its usefulness.
>
> Agreed.
>
> Perhaps instead of the current
>
>\new Staff = "piano_upper"
>
> mechanism, we could have a
>
>\new Staff piano.upper
Though I'd like such a scheme, I'd not recommend it, because I see
breaking changes coming up ;)


> "id" that could be used for addressing by both Lilypond proper *and* the EE 
> [or any other extension/addon]? Other than the obvious coding requirement to 
> make the switch, is there any real impact on Lilypond itself switching from 
> '= "name"' syntax to 'name' syntax? Even if Lilypond didn’t yet 
> recognize/react to a path like "score.ps.piano.upper.Voice.A" (the way the EE 
> already does), such a change would at least align the two 
> labelling/addressing methods.
>
> Alternatively, we could consider changing the EE to do addressing the way 
> it’s done in Lilypond proper… but I feel like that would be a step backwards.
>
>>> It would be wise to ask whether there are use cases
>>> for any "pronouns" (like `.` and `..` in file paths, and `this`
The dots are from the dot-notation of lists. If you type

lst = "..".hui.buh
#(display lst)

you can see that `lst` is a list with symbols #'(.. hui buh)

In my templates package I have function to canonicalize such paths. I
will import that to the EE.

> Interesting… Because of the way timing works (or, in this case, doesn’t!) in 
> the EE, I sometimes have to write (e.g.)
>
>\editionMod my-edition 10 1/4 id-to-a-staff.Score \override …
this works? I thought you'D need
   \editionMod my-edition 10 1/4 id-to-a-staff \override Score.…


I hope to work on the discussed topics soon, but my desktop is stuffed ...

It was an amzing weekend! Thank you all :)

Jan-Peter



Re: Context paths (and the Edition Engraver)

2020-01-22 Thread Jan-Peter Voigt
Am 21.01.20 um 18:50 schrieb Dan Eble:
> On Jan 21, 2020, at 11:31, Jan-Peter Voigt  wrote:
>> I'd like that, though it would be a quite invasive change.
>> And if we stay with the string for the context id and then use
>> lists/paths in the \context statement like
>> \new Staff = "choir" << \new Voice = "soprano" …
>>
>> and then use
>> \context Voice = choir.soprano
>>
>> it would be inconsistent with \new  = "…"
>>
>> I will write down some more text about this topic later.
>
> I see similarities with languages like CSS and XPATH select nodes in a DOM.  
> Notation borrowed directly from them will not integrate well into LilyPond, 
> but it might be fruitful to ask how we could modify expressions like these to 
> fit in.
>
> %% find the voice in the example quoted above, very specifically
> \context Staff#choir > Voice#soprano { … } % CSS
> \context Staff[@id=choir]/Voice[@id=soprano] { … } % XPATH
>
> %% ditto, but using context type only
> \context Staff > Voice { … }   % CSS
> \context Staff/Voice { … } % XPATH
>
> %% ditto, but using ID only
> \context #choir > #soprano { … }   % CSS
> \context [@id=choir]/[@id=soprano] { … }   % XPATH
>
> %% find the context where the rehearsalMark property is defined
> \context [rehearsalMark] { … } % CSS
> \context [@rehearsalMark] { … }% XPATH
> —
> Dan
>

I am amazed what kind of discussion is raised on this topic :)

I'd suggest alternative commands to create something like an
XQuery/CSS/whatever functionality. Elsewhere in this thread David (K)
answered to syntax ideas that would break the current model.

To have the possibility to address contexts *like* in CSS has some
appeal. But IMHO it shouldn't disturb the current input scheme. So
alternate commands might help here.
Perhaps *like*:

\getContext the.path.to.the.context

... or ...

\getContext \thisContext."..".otherContextsName

*don't know if implementing \thisContext is trivial*

The idea that an ID of a context is a list and not a string does attract
me, but I see a major change that has to be done very carefully.

If the ID is a string (or symbol) the path can be easily constructed
with ly:context-parent.
Something like:
%%
\version "2.19.83"

logContextPath = \applyContext
#(lambda (context)
   (define (context-path context)
 (let ((parent (ly:context-parent context)))
   (if (ly:context? parent)
   `(,@(context-path parent) ,(ly:context-id context))
   (list (ly:context-id context)))
   ))
   (ly:message "context path: ~A" (context-path context)))

\new Score = "mymusic" {
  \new StaffGroup = "choir" <<
\new Staff = "soprano" <<
  { c''4 \logContextPath } \\
  { g'4 \logContextPath }
>>
  >>
}
%%


Just some thoughts.

I hope to be able to write some more text about it soon.
But I have another task that will take up a lot of my time in the coming
weeks. You are welcome to ask me questions which I will try to answer.
But I will not be able to be active for the next weeks.

Jan-Peter



Re: shape and chords

2012-06-26 Thread Jan-Peter Voigt

Hi David,

On 25.06.2012 18:23, David Nalesnik wrote:
I tried to fix what was amiss in your adaptation of \shape, but I 
didn't get very far.  This problem seems very complex, and I was only 
able to get results by "starting from the ground up" -- namely, adding 
to the function I initially sent.  It's awfully compressed. 
 Hopefully, this is another step in the right direction.

it is! Thank you very much!
Your example is working as expected :)

To make it (more) usable, I think, we need wrapper functions, to avoid 
twiggling with endless listoflistoflistofnumberpairs ;-)


The check, if one offset-list is a list of lists, like in \shape, is IMO 
not needed here, because it gets more confusing, if we allow leaving the 
structure: list-of-ties -> list-of-siblings -> list-of-offsets.
And the other code is about the flexibility to change between different 
grobs (Tie,Slur,etc). In this code, we are talking only about TieColumns.


In my short test, I thought of having tie-configuration and shape 
combined, so that one can set the direction of the ties, before shaping 
them. The downside is, that using this also needs the staff-positions to 
be set - so I doubt, this is useful:


--snip--
confShapeTieColumn =
#(define-music-function (parser location conf all-offsets)(list? list?)
   (let ((alb-func (lambda (grob)
 (let ((ties (ly:grob-array->list (ly:grob-object 
grob 'ties

   (for-each
(lambda (tie offsets-for-broken-pair)
  (let* ((orig (ly:grob-original tie))
 (siblings (ly:spanner-broken-into orig)))
(for-each
 (lambda (piece offsets-for-piece)
   (if (pair? offsets-for-piece)
   (set! (ly:grob-property piece 
'control-points)

 (map
  (lambda (x y) 
(coord-translate x y))

(ly:tie::calc-control-points piece)
  offsets-for-piece))
   ))
 (if (null? siblings)
 (list orig)
 siblings)
 offsets-for-broken-pair)))
ties all-offsets)))
   ))
 (make-music 'SequentialMusic
   'elements (list
  (make-music 'ContextSpeccedMusic
'context-type 'Bottom
'element (make-music 'OverrideProperty
   'once #t 'pop-first #t
   'grob-property-path '(tie-configuration)
   'grob-value conf 'symbol 'TieColumn))
  (make-music 'ContextSpeccedMusic
'context-type 'Bottom
'element (make-music 'OverrideProperty
   'once #t 'pop-first #t
   'grob-property-path '(after-line-breaking)
   'grob-value alb-func 'symbol 'TieColumn))
  ))
 ))


{
  1 ~
  \confShapeTieColumn
  #'( (-6 . 1) (-4 . 1) (-2 . 1) (0 . 1) )
  #'(
 ( ((0 . 0)(0 . 0)(0 . 0)(0 . 0)) )
 )
  q
}
--snip--

For completeness I created drafts for RepeatTieColumns and 
LaissezVibrerTieColumns. Note that after-line-breaking is reasonably not 
called, so I used before-line-breaking here:

--snip--

shapeLaissezVibrerTieColumn =
#(define-music-function (parser location all-offsets) (list?)
   #{
 \once \override LaissezVibrerTieColumn #'before-line-breaking =
 #(lambda (grob)
(let ((ties (ly:grob-array->list (ly:grob-object grob 'ties
  (for-each
   (lambda (tie offsets-for-piece)
  (if (pair? offsets-for-piece)
  (set! (ly:grob-property tie 'control-points)
(map
 (lambda (x y) (coord-translate x y))
 (ly:tie::calc-control-points tie)
 offsets-for-piece))
  ))
   ties all-offsets)
  #t
  ))
   #})
shapeRepeatTieColumn =
#(define-music-function (parser location all-offsets) (list?)
   #{
 \once \override RepeatTieColumn #'before-line-breaking =
 #(lambda (grob)
(let ((ties (ly:grob-array->list (ly:grob-object grob 'ties
  (for-each
   (lambda (tie offsets-for-piece)
  (if (pair? offsets-for-piece)
  (set! (ly:grob-property tie 'control-points)
(map
 (lambda (x y) (coord-translate x y))
 (ly:tie::calc-control-points tie)
 offsets-for-piece))
  ))
   ti

Re: shape and chords

2012-06-27 Thread Jan-Peter Voigt

Hi David,

On 26.06.2012 20:27, David Nalesnik wrote:

Hi Jan-Peter,

First of all, I agree with David Kastrup that this is a situation 
where a deep fix is in order so that simultaneous ties may be tweaked 
directly.

+1


In my short test, I thought of having tie-configuration and shape
combined, so that one can set the direction of the ties, before
shaping them. The downside is, that using this also needs the
staff-positions to be set - so I doubt, this is useful:


This is a useful combination, and setting staff-positions really isn't 
all _that_ inconvenient since you can include a "non-entry" for 
default ties.  I'm delighted to see that overrides of the two work 
together!  It's nice to be able to group both functionalities into one 
command.

Glad to hear it ;-)


One question I have here with your formulation concerns the way you've 
expanded the overrides.  Why not use #{  . . . }# syntax here?  The 
only drawback I see is that dollar-signs would be needed with 2.14.  I 
don't see any issues in 2.15.40 with the replacement I've done below:



--snip--
confShapeTieColumn =
#(define-music-function (parser location conf all-offsets)(list?
list?)
  (let ((alb-func (lambda (grob)

(let ((ties (ly:grob-array->list
(ly:grob-object grob 'ties
  (for-each
   (lambda (tie offsets-for-broken-pair)
 (let* ((orig (ly:grob-original tie))
(siblings (ly:spanner-broken-into
orig)))
   (for-each
(lambda (piece offsets-for-piece)
  (if (pair? offsets-for-piece)
  (set! (ly:grob-property piece
'control-points)
(map
 (lambda (x y)
(coord-translate x y))
(ly:tie::calc-control-points piece)
 offsets-for-piece))
  ))
(if (null? siblings)
(list orig)
siblings)
offsets-for-broken-pair)))
   ties all-offsets)))
  ))

  #{
  \once \override TieColumn #'tie-configuration = #conf
  \once \override TieColumn #'after-line-breaking = #alb-func
  #}))
You're absolutely right, these two overrides are a lot easier to read in 
#{#}-lily-syntax. I sometimes use the scheme-way, if I want the location 
variable to be the one from this function and not the one from the 
#{#}-block. But for this case, it does not make so much sense ;-)


Best, Jan-Peter


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


Re: Waltrop meeting outline

2012-08-19 Thread Jan-Peter Voigt
Wow, this sounds very interesting and I am really sad, that I can not join this 
meeting. Will you record and publish parts on video or audio? Well, of course 
there has to be a somewhat recordable prepared presentation ... someone 
preparing and presenting.

I hope you have a somewhat successful meeting and a good time together ;)
Cheers, Jan-Peter




Am 19.08.2012 um 15:02 schrieb David Kastrup :

> 
> Details are still somewhat fuzzy since I don't have all that much
> feedback concerning who will arrive when and leave, but there are some
> corner points.
> 
> Apparently Janek will be arriving in advance.  No details yet as to his
> exact travel time and accommodation wishes: like anybody else not having
> mentioned anything, I count on him bringing sleeping bag or other
> bedcloths.
> 
> Marc mentioned coming as well as Rodolfo.  Rodolfo wanted to talk about
> using LilyPond in a professional print environment, as they are starting
> a new series of printed music books ("Musik aus Schweizer Klöstern").
> 
> As Marc was not able to work the stock instrument I can offer here, he
> was thinking of bringing his left-handed guitar.  I have no precise idea
> about the exact dates of those two participants and whether it might
> make sense for them to organize sharing a car part of the trip (Munich
> and Zurich, IIRC).
> 
> Harm/Thomas Morley intended to come on Saturday, stay probably until
> Monday and camp on the premises.
> 
> John and Graham will be there essentially the whole time, John bringing
> a sleeping bag.  We'll find a bed for Graham since he does not own a
> sleeping bag and arrives by plane.  Mike arrives on Saturday noonish and
> will leave on Tuesday noonish.
> 
> I'll dig out suitable connections for people arriving at Düsseldorf by
> flight/high speed train later.
> 
> The schedule would focus on stable release work and criteria on Friday,
> with the goal of getting most participants hands-on experience or at
> least exposure to GUB work.  Coursework goal is the release of 2.16, and
> getting the computing facilities up and running.
> 
> Saturday and Sunday are focused on programming courses.  Nils Gey asked
> for the best single day to come and talk about Laborejo and likely also
> music production in general, and I considered Sunday to be likely best
> fit.  We'll probably put pure/unpure and other backend programming stuff
> from user level on Saturday, also general Scheme programming and
> frontend syntax stuff.
> 
> On the weekend, I would like to squeeze in at least some entry-level
> "garbage-collection and other Guile/C++ interaction" and possibly some
> "what kind of syntax can be achieved and debugged at the C++ level with
> reasonable effort" discussion, with the more heavy-handed stuff being
> put on Monday.
> 
> In case of "let's see what kind of release work we can get done", 2.17.0
> might be possible on Sunday or Monday.  We should at least arrive at a
> good agreement about how to tackle the humongous 2148 merge which is
> definitely called for post-2.17.0.
> 
> -- 
> David Kastrup
> 
> ___
> lilypond-devel mailing list
> lilypond-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/lilypond-devel

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


Re: [proposal] easy triplets and tuplets - was [talk] easy tuplets

2012-10-05 Thread Jan-Peter Voigt

Hello James, Ian and list,

On 05.10.2012 09:10, James wrote:

Hello,

On 5 October 2012 00:19, Ian Hulin  wrote:

This is a proposal to move the triplet/tuplet discussion forward.

There will be new commands to supplement (or eventually replace) the
current \times command.

1. \tuplet n/m {}
%  does what \times does, but not so easily confused with \time
%  command.
2. \triplet {} % shorthand for current
%  \times 2/3 command
3. \duplet {
Do we need all these commands?
I think they are welcome shortcuts for very common tuplets. If you have 
some sophisticated piece with 7/5 tuplets, you can still use tuplet/times.
But for all those piece with long runs of triplets, I always define a 
music-function trip = #(define-music-function (parser location 
mus)(ly:music?) #{ \times 2/3 { $mus } #})

Can't we just have \tupelet and then a qualifier (or whatever it is
called) that then determines if it is 3/2. 2/3, 6/4 etc.

I may be the only one but no one that I play with makes any
distinction from a musical point of view between a 'tupelet' that is
2/3 and one that is, say, 5/3 or 6/4. They are all 'tupelets.

http://en.wikipedia.org/wiki/Tuplet

Am I missing something Ian (if so, sorry)?


Tuplets are tuplets so why should it be
trip and quad should get along so awfully ...

IMHO tuplets deserve dignity ... but if we have to write them down, it 
doesn't hurt to use shortcuts for the common trips.


Cheers, Jan-Peter


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


cue lyrics

2013-02-07 Thread Jan-Peter Voigt

Hello lists,

I am trying to get cued lyrics. There has been a mail of Rainhold 
Kainhofer: 
http://lilypond.1069038.n5.nabble.com/Obtaining-the-current-staff-s-context-id-from-withing-a-voice-td115463.html
I can fetch the cueVoices parental Staff-ContextId ... see attached file 
... but now I have another problem:
If the last note of the cued music gets an associated syllable, the 
following notes of the main Voice are shifted together (see attached PDF)


Does someone know how to prevent this?

Best, Jan-Peter

\version "2.16.0"

% cue function that typesets associated lyrics
cueDuringWithLyrics =
#(let ((stafftag 'Staff)
   (cuenr 0))
   ; cue voice counter, if there are multiple simultaneous quotes
   (define (cue-id) (set! cuenr (+ 1 cuenr)) (format "cue~A" cuenr))
   ; get context property for alignment
   (define (alignlyrics direction)(if (eq? UP direction) 'alignAboveContext 'alignBelowContext))
   ; the music function
   (define-music-function (parser location quote direction lyrics music)
 (string? integer? ly:music? ly:music?)
 ; we need the staff-id of the contained cueVoice
 ; and we need a cue-id
 (let ((staffid #f)
   (cueid (cue-id)))
   ; dummy engraver to get the parental staff-id
   (define (getstaffid context)
 (let ((staff (ly:context-find context stafftag)))
   (if (ly:context? staff) (set! staffid (ly:context-id staff)))
   ; this engraver does nothing
   (list)))
   ; engraver to set the lyric alignment
   (define (aligncue context)
 `((initialize .
 ,(lambda (trans)
; if we have a staff-id ...
(if (string? staffid)
; ... set the alignment property
(ly:context-set-property! context (alignlyrics direction) staffid)
))
 )))
   ; now create the music
   #{
 <<
   % the music voiceOne/Two for UP/DOWN resp.
   { $(if (eq? direction UP) #{ \voiceTwo #} #{ \voiceOne #}) $music }
   \new CueVoice = $cueid \with {
 % create CueVoice with staff-id grabbing engraver
 \consists #getstaffid
   } {
 % the cued music voiceOne/Two for UP/DOWN resp.
 $(if (eq? direction UP) #{ \voiceOne #} #{ \voiceTwo #})
 % the cue is quoted, use a skip event ... the music is in the main part
 \quoteDuring $quote { $(skip-of-length music) }
   }
   % create the lyrics with smaller text-size
   \new Lyrics \with {
 % the alignment setter fetches the grabbed staff-id
 \consists #aligncue
 fontSize = -2
 \override LyricText #'font-shape = #'italic
   } % lyricsto the CueVoice
   \lyricsto $cueid \lyricmode { $lyrics }
 >>
 % reset voice to oneVoice
 \oneVoice
   #}
   )))

%
%%% Example

% create quote
\addQuote "myquote" \relative c'' {
  \repeat unfold 10 { bes4 a c b }
}

% make music ...
<<
  % staff with a unique context-id
  \new Staff = "mystaff1" {
R1
% cue with lyrics: one syllable less than needed
\cueDuringWithLyrics "myquote" #DOWN \lyricmode { b a c h x y z } { R1*2 }
% more music
\relative c'' \repeat unfold 4 { c4 a f d }
  }
  \new Staff = "mystaff2" {
R1
% cue with lyrics: more syllables than needed
\cueDuringWithLyrics "myquote" #UP \lyricmode { b a c h x y z q q q } { R1*2 }
% the following notes are shifted, if the last cue-note has a syllable?
\relative c'' \repeat unfold 4 { c4 a f d }
  }
>>


cueLyrics.pdf
Description: Adobe PDF document
___
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel


BUG? simultaneous Music and Lyrics

2013-02-08 Thread Jan-Peter Voigt

Hello list,

while trying to create a cueDuringWithLyrics command, I stumbled over an 
issue:

To make the mentioned command, I create SimultaneousMusic containing
1. the music of the main voice (usually rests)
2. a named CueVoice containing quoteDuring
3. a Lyrics context, associated to the CueVoice

If there are no Lyrics, this works as expected. If the Lyrics context 
has syllables until the end of the CueVoice *and* the music-length of 
the main Voice is less or equal to the music-length of the CueVoice, the 
timing of music after this SimultaneousMusic passage is "disturbed".

I attached an example containaing two scores, displaying this issue.

Can someone deal with this?

Best, Jan-Peter



simultaneousLyrics-Bug.pdf
Description: Adobe PDF document
\version "2.16.1"

% log process music
logeng = #(lambda (context)
`((process-music .
,(lambda (trans)
   (ly:message "~A - ~A - ~A"
 (ly:context-name context)
 (ly:context-property context 'currentBarNumber)
 (ly:context-property context 'measurePosition))
   ))
  ))

% some notes
music = \relative {
  c4 e g a
}
postmusic = { \music c''1 }

\score {
  % Staff, CueVoice and Lyrics log every process-music call
  % It should be equivalent, if the notes past this cue-section 
  % are given within or after the SimultaneousMusic passage
  <<
\new Staff \with { \consists \logeng } {
  <<
{
  \voiceOne R1
}
\new CueVoice = "cue" \with {
  \consists \logeng
} \relative {
  \voiceTwo \music
}
\new Lyrics \with {
  \consists \logeng
} \lyricsto "cue" \lyricmode { la la la la la }
  >>
  % if the post notes are given after the Simul. passage, notes are squashed to a chord
  \postmusic
}
\new Staff \with { \consists \logeng } {
  <<
{
  % here everything is fine
  \voiceOne R1 \postmusic
}
\new CueVoice = "cue" \with {
  \consists \logeng
} \relative {
  \voiceTwo \music
}
\new Lyrics \with {
  \consists \logeng
} \lyricsto "cue" \lyricmode { la la la la la }
  >>
}
  >>
}

\score {
  <<
\new Staff \with { \consists \logeng } {
  <<
{
  \voiceOne R1
}
\new CueVoice = "cue" \with {
  \consists \logeng
} \relative {
  \voiceTwo \music
}
\new Lyrics \with {
  \consists \logeng
} \lyricsto "cue" \lyricmode { la la la la la }
  >>
  % if the post notes are given after the Simul. passage, notes are squashed to a chord
  \postmusic
}
  >>
}
___
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel


Re: BUG? simultaneous Music and Lyrics

2013-02-08 Thread Jan-Peter Voigt

I think this may be
http://code.google.com/p/lilypond/issues/detail?id=2010>

\lyricsto may turn into a voice-mangling zombie when both parents die at
the same time

thanks



Please reduce this to a tiny example. 
http://www.lilypond.org/website/tiny-examples.html


--
Phil Holmes

OK?

Best, Jan-Peter



simultaneousLyrics-Bug.pdf
Description: Adobe PDF document
\version "2.16.1"

\new Staff {
  <<
{
  \voiceOne R1
}
\new CueVoice = "cue" {
  \voiceTwo c'4 e' g' b'
}
\new Lyrics \lyricsto "cue" \lyricmode { la la la la la }
  >>
  { c''4 b' c'' d'' c''1 }
}

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


Re: segfault when making grob in scheme engraver

2013-03-01 Thread Jan-Peter Voigt

Hi Rekado,

I think, this is expectable. The stop-translation-step is too late ... 
you should create grobs in process-music.
If you want this to happen as a last action, you should look at the 
order of all engravers. The last instanciated engraver should be 
processed last, IIRC


HTH, Jan-Peter



On 01.03.2013 05:10, rekado rekado wrote:

\version "2.16.1"

#(define segfault-engraver
   (list
(cons 'stop-translation-timestep
 (lambda (trans)
  ;; creating the grob causes the segfault
  (let ((x (ly:engraver-make-grob trans 'TextScript '(
   (ly:grob-set-property! x 'text "hi"))

\layout {
   \context {
 \Score
 \accepts "SegTab"
   }
   \context {
 \Staff
 \name "SegTab"
 \accepts "SegVoice"
   }
   \context {
 \Voice
 \name "SegVoice"
 \consists \segfault-engraver
   }
}

\header {
   title = "Segfault"
}

\score {
   \new GrandStaff
   <<
 \time 4/4
 \new SegTab {
   \new SegVoice = melody {
 \relative f {
   c'8-1\4 d-2 e4-3 f\3 g8-4
 }
   }
 }

 \new SegTab {
   \new SegVoice = bass {
 \relative f {
   c,8-1\8 d e f4 g
 }
   }
 }
   >>
}



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


Re: R shorthand

2013-03-20 Thread Jan-Peter Voigt

Am 20.03.2013 02:16, schrieb David Kastrup:

Kieren MacMillan  writes:


Hi Shane,


  What happens when we need an awkward length R like R1*12/8*14?

I'm not sure what you mean by "awkward length"…

I'm suggesting that R (with no duration given) should give you a
one-measure multi-measure rest, regardless of what the measure
duration is.

I just realized that the total musical length of music expressions is
established _before_ iteration (and some manipulations require it to be
known), while the varying measure length is established by properties
set _during_ iteration.

So whatever the syntax: no can do.  Surprising as that may seem.
This sound reasonable and is what I came across, when trying to deal 
with this myself ... well, I wasn't sure, if I was right ...


So I know I have to know the measure length before creating my 
full-measure rests - I created a few functions (taktSkip/Rest/Meta).
There were a lot pieces of music with frequently alternating time 
signatures. I mostly use { \taktMeta 3/4 5 } in my global part, to 
create (in this example) 5 measures of 3/4. The function combines the 
creation of the time signature and the skip event. To create rests in 
music, nowadays I prefer { R1*3/4*5 }. It is still shorter than { 
\taktRest 3/4 5 }


Cheers,
Jan-Peter

\version "2.16.1"

% skip count measures of signature frac
taktSkip =
#(define-music-function (parser location frac count)(fraction? integer?)
   (let ((nom (car frac))
 (den (cdr frac)))
 (make-music
  'SkipEvent
  'duration
  (ly:make-duration (inexact->exact (/ (log den)(log 2))) 0 (* nom count) 1

% rest count measures of signature frac
taktRest =
#(define-music-function (parser location frac count)(fraction? integer?)
   (let ((nom (car frac))
 (den (cdr frac)))
 (make-music
  'MultiMeasureRestMusic
  'duration
  (ly:make-duration (inexact->exact (/ (log den)(log 2))) 0 (* nom count) 1

% create time signature and then skip count measures of signature frac
taktMeta =
#(define-music-function (parser location frac count)(fraction? integer?)
   (let ((nom (car frac))
 (den (cdr frac)))
 (make-music 'SequentialMusic
   'elements (list
  (make-music 'TimeSignatureMusic
'beat-structure '()
'denominator den
'numerator nom)
  (make-music
   'SkipEvent
   'duration
   (ly:make-duration (inexact->exact (/ (log den)(log 2))) 0 (* nom count) 1))
  

% example
\new Staff <<
  % global/meta part: 9 measures of 5/8
  { \taktMeta 5/8 3 \bar "||" \taktMeta 3/4 6 \bar "|." }
  % the music: here just rests and skips
  {
\taktRest 5/8 3
\taktRest 3/4 2
<< { \taktSkip 3/4 2 } { s4^"skip 2 meas." } >>
\taktRest 3/4 2
  }
>>

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


Re: R shorthand

2013-03-20 Thread Jan-Peter Voigt

Am 20.03.2013 09:55, schrieb David Kastrup:

Jan-Peter Voigt  writes:

[...]


   (ly:make-duration (inexact->exact (/ (log den)(log 2))) ...

That's a terribly broken thing to do.  inexact->exact does not change
the value one bit, only its interpretation.  A number considered to be
_approximated_ by integer*2^power is now considered to be _exactly_
integer*2^power.  Try using ly:intlog2 instead.

Thank you. I wasn't aware of this function, when I created my little 
helper snippets.




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


[issue 1482] \caps \fromproperty and markup->string

2011-10-06 Thread Jan-Peter Voigt

http://code.google.com/p/lilypond/issues/detail?id=1482

Hello lists,

using \fromproperty, \smallCaps (=\caps) and markup->string leads into 
some pitfalls:
1. if you want to use custom (self written) markup-commands, the default 
"markup->string" function will drop the content of them.
2. if you want to use caps, that function expects a string to capsify, 
so that if you try "\caps \italic text" the text will only be italic but 
not capsified.
3. if you want to use \fromproperty #'sym within caps or markup->string, 
the result will be empty.


I post these three in one mail, because the problems are related.

Here are my tries overcoming these obstacles:
1. a redesigned markup->string function, that is command-independent and 
looks for fromproperty-markups
2. a recaps markup-command relying on a recursive function capsifying 
all found strings and fromproperty-markup-results


This design may lead to other problems: E.g. if you have an arbitrary 
markup-command, wich takes a markup to scale another one, that 
gauge-markup will be put into the string


Right now this is not a patch for devel, because I am running stable and 
use this for my current projects.


Cheers,
Jan-Peter

--snip--
\version "2.14.2"

% taken from markup.scm
#(define (markup-function? x)
(and (markup-command-signature x)
 (not (object-property x 'markup-list-command

% a markup-command-independent markup->string function
#(define-public (markup->string mup . mprops)
  (let ((conc (if (> (length mprops) 0) (car mprops) #f))
(layout (if (> (length mprops) 1) (cadr mprops) #f))
(props (if (> (length mprops) 2) (caddr mprops) '()))
(mup? (lambda (m)(or (string? m)(list? m)(markup? m
(result ""))
   (cond ((string? mup) (set! result mup))
 ((null? mup) (set! result ""))

 ((and (pair? mup) (equal? (car mup) concat-markup))
  (set! result (markup->string (cdr mup) #t layout props)))

 ((and (pair? mup) (equal? (car mup) fromproperty-markup))
  (set! result (markup->string (chain-assoc-get (cadr mup) 
props "???") conc layout props)))


 ((and (pair? mup)(markup-function? (car mup)))
  (for-each (lambda (m)(set! result (string-append result 
(if (or conc (string=? result "")) "" " ") (markup->string m conc layout 
props

(filter mup? (cdr mup
 ((list? mup)
  (for-each (lambda (m)(set! result (string-append result 
(if (or conc (string=? result "")) "" " ") (markup->string m conc layout 
props

(filter mup? mup)))
 (else (ly:message "~A" mup)))
   result))
% plain text markup
#(define-markup-command (plain-text layout props arg)(markup?)
  (interpret-markup layout props (markup (markup->string arg #f layout 
props


% apply caps to all strings found in m
#(define-public (rcaps m . mprops)
  (let ((layout (if (> (length mprops) 0) (car mprops) #f))
(props (if (> (length mprops) 1) (cadr mprops) '()))
(mup? (lambda (m)(or (string? m)(list? m)(markup? m
(ret (markup)))
   (set! ret
 (cond
   ((string? m) (markup #:caps m))
   ((null? m) "")
   ((and (pair? m) (equal? (car m) fromproperty-markup))
(markup #:caps (chain-assoc-get (cadr m) props "???")))
   ((and (pair? m)(markup-function? (car m))) (cons (car m)
  (map (lambda (mup)(if (mup? mup) (rcaps mup layout 
props) mup)) (cdr m

   ((list? m)
(map (lambda (mup)(rcaps mup layout props)) m))
   (else "ERROR, unable to caps markup"))
   )
   ret)
)
% recursive caps markup command
#(define-markup-command (recaps layout props mup)(markup?)
  (interpret-markup layout props (rcaps mup layout props)))

% example/test

test = \markup {
  Hallo \recaps { Welt \fontsize #3 Du große \concat { \italic { Welt 2 
3 } \fromproperty #'dummytext } }

}
#(display (markup->string test #f #f '(((dummytext . "bla"))) ))
\markup {
  \override #'(dummytext . "bla") \column {
\test
\plain-text \test
  }
}
--snip--



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


music variables and music templates - an idea

2011-10-18 Thread Jan-Peter Voigt

Hello list,

I created some functions  to store music in a hierarchical tree. This 
"music store" leads to the possibility to store music in one place and 
to get voices/parts in a defined template.
If you have to put several choral pieces in one book, you can first fill 
all voices in this tree with a structure /notes/[sop|alt|ten|bas] 
and then later refer to that music in a common SATB-template. If your 
book shall have another look for all choral pieces, you only have to 
change the template. And if you want to combine several pieces in one 
bookpart, you can first \include all music definitions, then display the 
music where you like to.


In this example file, I inserted one choral piece (SATB), wich is first 
displayed in a four-stave-four-lyric-system, then in a 
two-stave-one-lyric-system.


In the underlying tree, wich is an alist, you can access values by path, 
wich is a list of symbols - for example (tree-get tree '(path to value))

One value can be stored in path '()
Like with assoc-set!, the actual tree is not modified, but the modified 
is returned.
These tree-functions are used in the get/put-music-functions, wich are 
actually defined in a closure.


If I typeset pieces, I use a modified include-function, wich only 
includes, if the outname equals the location-name. This way I can 
"\includeLocal" a testfile, wich instantiates the current piece (wich is 
set before) only if I am working on that specific file:

--snip--
#(define-public includeLocal (define-music-function (parser location 
file)(string?)

(let ((outname (format "~A.ly" (ly:parser-output-name parser)))
  (locname (car (ly:input-file-line-char-column location
 (if (string=? outname locname)
 (let ((content (ly:gulp-file file)))
  (ly:parser-include-string parser content)))
 (make-music 'SequentialMusic 'void #t
--snip--

I know, this is another way to handle this 
multi-score-in-one-book-thing. But perhaps it includes at least some 
useful ideas.
If this is of interest, I'd like to get respond and suggestions to 
improve it.


Cheers,
Jan-Peter

\version "2.14.2"

%%%%%%
%%% template and music store mechanism
%%% (c) 2011 by Jan-Peter Voigt

%%
%%% helpers

#(define-public (path->string lst)
  (string-join (map (lambda (s)(format "~A" s)) lst) "/" 'infix))

%%%
%%% a tree in scheme
%%% tree = (key . (val . (list)))

% tree predicate
#(define-public (tree? t)
  (let ((and-list (lambda (l) (let ((b #t)) (for-each (lambda (x) (set! b (and b x))) l) b
   (and (pair? t)
(symbol? (car t))
(pair? (cdr t))
(list? (cdr (cdr t)))
;; (and-list (map (lambda (x) (tree? x)) (cdr (cdr t
   )
))
% create an empty tree
#(define-public (tree-create sym)(cons sym (cons #f (list

% set value in tree, path is a list
#(define-public (tree-set! tree path val)
  (let ((sym (if (and (list? path)(> (length path) 0))(car path) #f))
(leaf (= (length path) 0)))
   (if (not (tree? tree)) (set! tree (tree-create 'root)))
   (let ((cval (car (cdr tree)))
 (clst (cdr (cdr tree
(set! tree 
  (cons (car tree)
(if leaf
  (cons val clst)
  (cons cval (assoc-set! clst sym (cdr (tree-set! (assoc sym clst) (if (> (length path) 1) (cdr path) '()) val )) ))
)
))
   )
   tree))
% get value from tree, path is a list
#(define-public (tree-get tree path)
  (let ((sym (if (and (list? path)(> (length path) 0))(car path) #f))
(leaf (= (length path) 0)))
   (if (tree? tree)
   (if leaf (car (cdr tree)) (tree-get (assoc sym (cdr (cdr tree))) (if (> (length path) 1) (cdr path) '())) )
   #f)
))

% get branch from tree
#(define-public (tree-get-tree tree path)
  (let ((sym (if (and (list? path)(> (length path) 0))(car path) #f)))
   (if (tree? tree)
   (if sym 
 (tree-get-tree (assoc sym (cdr (cdr tree))) (if (> (length path) 1) (cdr path) '()))
 tree)
   #f)
))

% walk through the tree and call (callback path key value)
% where path is the node path in the tree, key is the node name and value the value
#(define-public (tree-walk tree callback . opt)
  (if (tree? tree)
  (let ((path (ly:assoc-get 'path opt (list) #f))
(dosort (ly:assoc-get 'sort opt #f #f)))
   (if (not (list? path)) (set! path (list path)))
   (callback path (car tree) (car (cdr tree)))
   (for-each (lambd

"include" music-function

2012-01-05 Thread Jan-Peter Voigt

Dear lily-list-members,

first of all: A happy new year!

In my projects I often combine several files, each containing one piece, 
to a book.
In fact, I store the music in a scheme-based structure to instantiate it 
later.
The included files shall intentionally not create a PDF, so that 
instantiation can be organized in bookparts as needed.
But when I work on a specific piece I want to debug it without compiling 
the whole book.
One solution would be to use frescobaldi and a comment %%master: 
../.ly at the end of the file. But then I have to create a 
master-file for each part.
So I created a music-function to include a testfile wich contains 
instructions to instantiate the music stored in my structures only if I 
am compiling this file directly:

--snip--
#(define-public includeLocal (define-music-function (parser location 
file)(string?)

(let ((outname (format "~A.ly" (ly:parser-output-name parser)))
  (locname (car (ly:input-file-line-char-column location
 (if (or (string=? outname locname)(string-suffix? outname 
locname))

 (let ((content (ly:gulp-file file)))
  (ly:parser-include-string parser content)))
 (make-music 'SequentialMusic 'void #t

\includeLocal "test.ly"
--snip--
This function first compares the outname with the location name and only 
includes the file if they match. (This should not work, if you have set 
some output-suffix!)


This is a usable solution to me. But I would like to have the correct 
location info available, while parsing the included file.
Is it possible to create an arbitrary "include"-music-function? This 
would make it possible, to (for example) include all files in a 
directory or matching a specific pattern.


Cheers,
Jan-Peter


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


Re: "include" music-function

2012-01-05 Thread Jan-Peter Voigt

Hello David,

Any reason you don't just do #{ \include #file #} here?


yes there is:
--snip--
\version "2.15.21"

#(define-public includeLocal (define-music-function (parser location 
file)(string?)

(let ((outname (format "~A.ly" (ly:parser-output-name parser)))
  (locname (car (ly:input-file-line-char-column location
 (if (or (string=? outname locname)(string-suffix? outname 
locname))

 #{ \include $file #}
 (make-music 'SequentialMusic 'void #t)

\includeLocal "test.ily"
--snip--
this places the include in some context, generated by #{ #}.
So if I have:
--snip-- ("test.ily")
\version "2.15.21"

mus = \relative c' {
  c4 e g c
}

{ \mus }
--snip--
it will fail, because I try to assign "mus" here in a contained context.

Cheers,
Jan-Peter


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


Re: "include" music-function

2012-01-05 Thread Jan-Peter Voigt

Hello David,

Am 05.01.2012 13:50, schrieb David Kastrup:


Ah yes.  ly:parse-file does not help either?


yes it does, thanks ... but ...

--snip--
#(define-public includeLoc (define-music-function (parser location 
file)(string?)

(let ((outname (format "~A.ly" (ly:parser-output-name parser)))
  (locname (car (ly:input-file-line-char-column location
 (if (or (string=? outname locname)(string-suffix? outname 
locname))

 (ly:parse-file file))
 (make-music 'SequentialMusic 'void #t
--snip--

I nowadays store the music in a scheme structure saved as a singleton in 
a self-made module. If the included file refers to this singleton, the 
music will appear ... great!


Before this, I created variables
--snip--
music = \relative c' { c4 e g c }
\includeLocal "test-music.ly"
--snip--
and used a file
--snip-- (test-music.ly)
{ \music }
--snip--

This does not work ... the var "music" is not known in the file included 
with ly:parse-file.
There has been a function ly:parser-parse-file in 2.12 - and if my 
memory doesn't trick me, there has been discussion on devel why and how 
to remove it.

This might or might not have been useful in this context.
So a question remains: How could I carry defined variables between 
inside-outside ly:parse-file ?


Cheers,
Jan-Peter


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


Re: "include" music-function

2012-01-06 Thread Jan-Peter Voigt

Hello David,

the \sourcefilename hint is helpful! Thank you!
If I use this in my function and do a ly:parser-clone, the location is 
up to date:


--snip--
#(define-public showloc (define-music-function (parser location)()
(format #t ">>> ~A\n" (ly:input-file-line-char-column location))
(make-music 'SequentialMusic 'void #t)))

#(define-public includeLocal (define-music-function (parser location 
file)(string?)

(let ((outname (format "~A.ly" (ly:parser-output-name parser)))
  (locname (car (ly:input-file-line-char-column location
 (if (or (string=? outname locname)(string-suffix? outname 
locname))

 (ly:parser-parse-string (ly:parser-clone parser)
   (format "\\sourcefilename \"~A\"\n\\sourcefileline 
~A\n~A" file 0 (ly:gulp-file file

 (make-music 'SequentialMusic 'void #t
--snip--

Now I will look, if this is working also with ly:parser-include-string 
while resetting filename and fileline at the end, so that definitions in 
the included file get into the current parser.


Cheers,
Jan-Peter

Am 05.01.2012 17:14, schrieb David Kastrup:

Jan-Peter Voigt  writes:


#(define-public includeLocal (define-music-function (parser location
file)(string?)
 (let ((outname (format "~A.ly" (ly:parser-output-name parser)))
   (locname (car (ly:input-file-line-char-column location
  (if (or (string=? outname locname)(string-suffix? outname
locname))
  (let ((content (ly:gulp-file file)))
   (ly:parser-include-string parser content)))
  (make-music 'SequentialMusic 'void #t

\includeLocal "test.ly"
--snip--
This function first compares the outname with the location name and
only includes the file if they match. (This should not work, if you
have set some output-suffix!)

This is a usable solution to me. But I would like to have the correct
location info available, while parsing the included file.
Is it possible to create an arbitrary "include"-music-function? This
would make it possible, to (for example) include all files in a
directory or matching a specific pattern.

You can start your string with \sourcefilename and \sourcefileline.
ly:parser-parse-expression has optional arguments for that purpose.  If
you would consider this helpful, I might try fudging this into
parser-include-string as well.

I have not followed the reasons why we would not have
parser-include-file.




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


Re: "include" music-function

2012-01-06 Thread Jan-Peter Voigt

Am 06.01.2012 09:35, schrieb Jan-Peter Voigt:

Hello David,

the \sourcefilename hint is helpful! Thank you!
If I use this in my function and do a ly:parser-clone, the location is 
up to date:

...
Now I will look, if this is working also with ly:parser-include-string 
while resetting filename and fileline at the end, so that definitions 
in the included file get into the current parser.




... yes it does:

--snip--
#(define-public includeLocal (define-music-function (parser location 
file)(string?)

(let ((outname (format "~A.ly" (ly:parser-output-name parser)))
  (locname (car (ly:input-file-line-char-column location)))
  (locpos (cadr (ly:input-file-line-char-column location
 (if (or (string=? outname locname)(string-suffix? outname 
locname))

 (begin
   (ly:parser-include-string parser (format 
"\\sourcefilename \"~A\" \\sourcefileline 0\n" (ly:find-file file)))

   (ly:parser-include-string parser (ly:gulp-file file))
   (ly:parser-include-string parser (format " 
\\sourcefilename \"~A\" \\sourcefileline ~A\n" locname locpos

 (make-music 'SequentialMusic 'void #t
--snip--

... but if I include a file in an included file, it will not parse. I 
will investigate that for more info.


Cheers,
Jan-Peter


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


Re: "include" music-function

2012-01-06 Thread Jan-Peter Voigt

Am 06.01.2012 10:17, schrieb Jan-Peter Voigt:

Am 06.01.2012 09:35, schrieb Jan-Peter Voigt:

Hello David,

the \sourcefilename hint is helpful! Thank you!
If I use this in my function and do a ly:parser-clone, the location 
is up to date:

...
Now I will look, if this is working also with 
ly:parser-include-string while resetting filename and fileline at the 
end, so that definitions in the included file get into the current 
parser.




... yes it does:

--snip--
#(define-public includeLocal (define-music-function (parser location 
file)(string?)

(let ((outname (format "~A.ly" (ly:parser-output-name parser)))
  (locname (car (ly:input-file-line-char-column location)))
  (locpos (cadr (ly:input-file-line-char-column location
 (if (or (string=? outname locname)(string-suffix? outname 
locname))

 (begin
   (ly:parser-include-string parser (format 
"\\sourcefilename \"~A\" \\sourcefileline 0\n" (ly:find-file file)))

   (ly:parser-include-string parser (ly:gulp-file file))
   (ly:parser-include-string parser (format " 
\\sourcefilename \"~A\" \\sourcefileline ~A\n" locname locpos

 (make-music 'SequentialMusic 'void #t
--snip--

... but if I include a file in an included file, it will not parse. I 
will investigate that for more info.

OK, now I had lunch and saw my own mistakes ...

Here are the two functions I implemented ... still a bit clumsy, but it 
works for now ... if you are interested *how* and *why* to use them, 
don't hesitate to mail me!


--snip--
\version "2.15.21"

#(define-public includeLocal (define-music-function (parser location 
file)(string?)

(let ((outname (format "~A.ly" (ly:parser-output-name parser)))
  (locname (car (ly:input-file-line-char-column location)))
  (file (ly:find-file file)))
 (if (or (string=? outname locname) (string-suffix? outname 
locname))

 (begin
   ;(ly:input-message location "include ~A" file)
   (ly:parser-include-string parser (format 
"\\sourcefilename \"~A\" \\sourcefileline 0\n~A"

   file (ly:gulp-file file
 )
 (make-music 'SequentialMusic 'void #t

% EXAMPLE
% include file from lilypond search path (like \include)
\includeLocal "test-local.ily"

#(use-modules (ice-9 regex))
#(define-public includePattern (define-music-function (parser location 
idir pattern)(string? string?)

(let* ((normalize-list (lambda (path)
 (let ((ret '()))
  (for-each (lambda (e)
(set! ret (cond ((equal? e 
"..")(if (> (length ret) 1) (cdr ret) '()))
((equal? e 
".") ret)
(else `(,e 
,@ret) path)

  (reverse ret
   (normalize-path (lambda (s) (string-join (normalize-list 
(string-split s #\/)) "/" 'infix)))

   (extract-path (lambda (location)
 (let* ((loc (car (ly:input-file-line-char-column 
location)))

(dirmatch (string-match "(.*/).*" loc))
(dirname (if (regexp-match? dirmatch) 
(normalize-path (match:substring dirmatch 1)) "./")))

   dirname
   )))

   (dirname (string-append (extract-path location) idir)))

  (if (not (eq? #\. (string-ref dirname 0))) (set! dirname 
(normalize-path dirname)))

  (if (or (= (string-length dirname) 0)
  (not (eq? #\/ (string-ref dirname (- (string-length 
dirname) 1)

  (set! dirname (string-append dirname "/")))
  (if (or (not (file-exists? dirname)) (not (eq? 'directory 
(stat:type (stat dirname)

  (set! dirname #f))

  (if dirname (let* ((dir (opendir dirname))
   (entry (readdir dir)))
  (while (not (eof-object? entry))
 (if (regexp-match? (string-match pattern entry))
 (let ((file (string-append dirname entry)))
  ;(ly:input-message location "include 
~A" file)

  (ly:parser-include-string parser
(format "\\sourcefilename \"~A\" 
\\sourcefileline 0\n~A" file (ly:gulp-file file)

 (set! entry (readdir dir))
  )
  (closedir dir)
  ))
)
(make-music 'SequentialMusic 'void #t)))

% EXAMPLE
% param 1: file path of containing directory, relative to the including 
file!

% param 2: r

Re: "include" music-function

2012-01-07 Thread Jan-Peter Voigt
Hello Carl, Hello David,
thanks for your replies!
I will read through those threads next week. This might help me understand what 
is happening under the hood.

The basic include is working as expected. But I think it would be a nice 
feature if one could search for files to include using scheme.

Cheers,
Jan-Peter

Am 06.01.2012 um 21:40 schrieb Carl Sorensen :

> On 1/6/12 7:28 AM, "David Kastrup"  wrote:
> 
>> 
>> Now I don't want to repeat old mistakes, but I don't really have the
>> time for an extended investigation.  So if somebody gives me all the
>> data in a manner that does not require all too much thinking on my side,
>> I might try putting that kind of functionality back.
> 
> Here is a thread that discusses this problem.  You were not interested in
> eliminating
> parser-parse-file at this point, but it appears that it got eliminated
> anyway.
> 
> http://thread.gmane.org/gmane.comp.gnu.lilypond.devel/29392/focus=29404
> 
> 
> These patches came in response to issue 1096,
> 
> 
> 
> 
> where a segfault happened with parser-parse-string due to infinite
> recursion, IIUC.  Also see issue 1119:
> 
> 
> 
> 
> 
> A related thread (indexed in issue 1096) is:
> 
> http://lists.gnu.org/archive/html/lilypond-devel/2010-02/msg00106.html
> 
> 
> HTH,
> 
> Carl
> 
> 
> 

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


Re: "include" music-function

2012-01-07 Thread Jan-Peter Voigt
Ah, yes ... I will rewrite this, when I'm in my machine again 

Cheers, Jan-Peter


Am 07.01.2012 um 09:42 schrieb David Kastrup :

> Jan-Peter Voigt  writes:
> 
>> Am 06.01.2012 10:17, schrieb Jan-Peter Voigt:
>>> Am 06.01.2012 09:35, schrieb Jan-Peter Voigt:
>>>> Hello David,
>>>> 
>>>> the \sourcefilename hint is helpful! Thank you!
>>>> If I use this in my function and do a ly:parser-clone, the location
>>>> is up to date:
>>>> ...
>>>> Now I will look, if this is working also with
>>>> ly:parser-include-string while resetting filename and fileline at
>>>> the end, so that definitions in the included file get into the
>>>> current parser.
>>>> 
>>>> 
>>> ... yes it does:
>>> 
>>> --snip--
>>> #(define-public includeLocal (define-music-function (parser location
>>> file)(string?)
>>>(let ((outname (format "~A.ly" (ly:parser-output-name parser)))
>>>  (locname (car (ly:input-file-line-char-column location)))
>>>  (locpos (cadr (ly:input-file-line-char-column location
>>> (if (or (string=? outname locname)(string-suffix? outname
>>> locname))
>>> (begin
>>>   (ly:parser-include-string parser (format
>>> "\\sourcefilename \"~A\" \\sourcefileline 0\n" (ly:find-file file)))
>>>   (ly:parser-include-string parser (ly:gulp-file file))
>>>   (ly:parser-include-string parser (format "
>>> \\sourcefilename \"~A\" \\sourcefileline ~A\n" locname locpos
>>> (make-music 'SequentialMusic 'void #t
>>> --snip--
>>> 
>>> ... but if I include a file in an included file, it will not
>>> parse. I will investigate that for more info.
>> OK, now I had lunch and saw my own mistakes ...
>> 
>> Here are the two functions I implemented ... still a bit clumsy, but
>> it works for now ... if you are interested *how* and *why* to use
>> them, don't hesitate to mail me!
> 
> Actually, this is quite too complicated...
> 
> (ly:parser-include-string parser
>  (format #f "\\include ~S" file))
> 
> should likely be all that is needed here.
> 
> Sorry for thinking too complicated.
> 
> -- 
> David Kastrup
> 
> 
> ___
> lilypond-devel mailing list
> lilypond-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/lilypond-devel

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


Re: "include" music-function

2012-01-09 Thread Jan-Peter Voigt

Hello again,

Am 07.01.2012 09:42, schrieb David Kastrup:

Actually, this is quite too complicated...

(ly:parser-include-string parser
   (format #f "\\include ~S" file))

should likely be all that is needed here.

Sorry for thinking too complicated.


so its just:
--snip--
#(define-public includeLocal (define-music-function (parser location 
file)(string?)

(let ((outname (format "~A.ly" (ly:parser-output-name parser)))
  (locname (car (ly:input-file-line-char-column location
; condition when to include
 (if (or (string=? outname locname) (string-suffix? outname 
locname))
 (ly:parser-include-string parser (format "\\include 
\"~A\"\n" file)))

 (make-music 'SequentialMusic 'void #t
--snip--

So another solution to issue 1096, Carl mentioned, could be:
--snip--
#(define-public includeIf (define-music-function (parser location pred 
file)(procedure? string?)

 (if (pred parser location)
 (ly:parser-include-string parser (format "\\include 
\"~A\"\n" file)))

 (make-music 'SequentialMusic 'void #t)))

\includeIf #(lambda (parser location) (not (defined? 'defs))) "defs.ly"
--snip--
where in "defs.ly" somewhere defs is defined. Or the given lambda looks 
into a singleton containing all filenames already included or ...

Of course one could use just
--snip--
#(define-public includeIfNotDef (define-music-function (parser location 
sym file)(symbol? string?)

 (if (not (defined? sym))
 (ly:parser-include-string parser (format "\\include 
\"~A\"\n" file)))

 (make-music 'SequentialMusic 'void #t)))

\includeIfNotDef #'defs "defs.ly"
--snip--
Conclusion: To write a different include music-function, use 
(ly:parser-include-string parser (format "\\include \"~A\"\n" file)) so 
that this can be done in global context.


The other function I implemented is also only changing the 
parser-include-string and removes ly:gulp-file.
This is working for me and I am sharing it here, but I don't want to 
bother anyone to look thru this code. The only thing I'd like to know 
is: In %load-path the scheme search-path is stored ... where is the 
lilypond-search-path stored? I propably just didn't saw in the docs?


To explain the other include function a little bit (see below): The 
directory containing the file named in location is reference point for 
the directory search. Because ly:find-file doesn't find directories, I 
cannot refer to that. (It would be nice, but I'd call it a special thing 
and not an issue ;) ). One could use a reference file and include all 
siblings matching the pattern or ... or ...

This fits for me:
If I have a collection of files to include "part-.ly" in a directory 
called "parts" I can place a file "parts.ly" in the upper directory 
containing

--snip--
\includePattern "parts" "part-[0-9][0-9].ly"
--snip--
Parameters:
1 - string? directory to search
2 - string? regular expression to match filenames

The include order is not predictable, so the include files should 
contain variable definitions and not typeset by themself. Of course one 
could first collect all filenames in a list, sort it and then do the 
inclusion with for-each over that list.

But there might be many other ideas, how to search and include part-files.

Cheers,
Jan-Peter

--snip--
#(use-modules (ice-9 regex))
#(define-public includePattern (define-music-function (parser location 
idir pattern)(string? string?)

(let* ((normalize-list (lambda (path)
 (let ((ret '()))
  (for-each (lambda (e)
(set! ret (cond ((equal? e 
"..")(if (> (length ret) 1) (cdr ret) '()))
((equal? e 
".") ret)
(else `(,e 
,@ret) path)

  (reverse ret
   (normalize-path (lambda (s) (string-join (normalize-list 
(string-split s #\/)) "/" 'infix)))

   (extract-path (lambda (location)
 (let* ((loc (car (ly:input-file-line-char-column 
location)))

(dirmatch (string-match "(.*/).*" loc))
(dirname (if (regexp-match? dirmatch) 
(normalize-path (match:substring dirmatch 1)) "./")))

   dirname
   )))

   (dirname (string-append (extract-path location) idir)))

  (if (not (eq? #\. (string-ref dirname 0))) (set! dirname 
(normalize-path dirname)))

  (if (or (= (string-length dirname) 0)
  (not (eq? #\/ (string-ref dirname (- (string-length 
dirname) 1)

  (set! dirname (string-append dirname "/")))
  (if (or (not (file-exists? dirname)) (not (eq? 'directory 
(stat:type (stat dirname)

  (set! dirname #f))

  (if dirname (let* ((dir (opendir dirname))
   (entry (readdir dir)))
  (while (

Re: book-predicate

2012-03-02 Thread Jan-Peter Voigt

Hello David, hello lists,

now, when we have a book-predicate, we are dealing with books in scheme. 
And then we might want to set a header after creating a book.
There is a function ly:score-set-header!, which I copied and adapted for 
the Book-class.

This patch compiled and works with the following snippet.

--snip--
\version "2.15.32"

bk = \book {
  \score {
\relative c' {
  c4 e g b
}
  }
}

#(let ((bh (eval-string "(define-module (a b))")))
 (eval '(define title "Hallo") bh)
 (ly:book-set-header! bk bh))

\book { \bk }
--snip--

Is this helpful for lily-devel?
And is there another (better) way of creating a module (for header 
generation) on the fly in scheme?


Cheers,
Jan-Peter

On 27.02.2012 10:10, David Kastrup wrote:

Jan-Peter Voigt  writes:


Am 24.02.2012 um 16:24 schrieb:


Jan-Peter Voigt  writes:


Hello list,

when I use books or bookparts for (scheme-)function arguments, I
haven't found the predicate for it.
paper-book? is something else, or am I missing something?

Well, you can always use scheme? and file a feature request in the mean
time.

Thank you David,

the scheme?-solution is what I do right now. I will send a feature
request next days.

Don't bother.

commit 09814b549186893c265bcdf835edbe242f6354cf
Author: David Kastrup
Date:   Sun Feb 26 11:23:39 2012 +0100

 Implement ly:book? and ly:context-def? predicates

Note that a bookpart _is_ a book as well, usually without a paper block
of its own.



>From 40a1419a051402ee4bac6d8f7fa65e5b8353b815 Mon Sep 17 00:00:00 2001
From: Jan-Peter Voigt 
Date: Fri, 2 Mar 2012 09:54:20 +0100
Subject: [PATCH] add ly:book-set-header!

Add a scheme function ly:book-set-header! like ly:score-set-header!

Function is copied from score-scheme.cc to book-scheme.cc,
setting public member var header_ in class Book.
---
 lily/book-scheme.cc |   13 +
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/lily/book-scheme.cc b/lily/book-scheme.cc
index 7f1026a..ae505af 100644
--- a/lily/book-scheme.cc
+++ b/lily/book-scheme.cc
@@ -156,6 +156,19 @@ LY_DEFINE (ly_book_header, "ly:book-header",
   return b->header_ ? b->header_ : SCM_BOOL_F;
 }
 
+LY_DEFINE (ly_book_set_header_x, "ly:book-set-header!",
+   2, 0, 0, (SCM book, SCM module),
+   "Set the book header.")
+{
+  LY_ASSERT_SMOB (Book, book, 1);
+  SCM_ASSERT_TYPE (ly_is_module (module), module, SCM_ARG2, __FUNCTION__,
+   "module");
+
+  Book *b = unsmob_book (book);
+  b->header_ = (module);
+  return SCM_UNSPECIFIED;
+}
+
 LY_DEFINE (ly_book_scores, "ly:book-scores",
1, 0, 0, (SCM book),
"Return scores in @var{book}.")
-- 
1.7.0.4

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


ly:book-set-header!

2012-03-02 Thread Jan-Peter Voigt

Hello list,

sorry for resending this, it might get lost, because I simply answered 
to another thread with another subject.


now, we have a book-predicate and we are dealing with books in scheme. 
Then we might want to set a header after creating a book.
There is a function ly:score-set-header!, which I copied and adapted for 
the Book-class.

This patch compiled and works with the following snippet.

--snip--
\version "2.15.32"

bk = \book {
  \score {
\relative c' {
  c4 e g b
}
  }
}

#(let ((bh (eval-string "(define-module (a b))")))
 (eval '(define title "Hallo") bh)
 (ly:book-set-header! bk bh))

\book { \bk }
--snip--

Is this helpful for lily-devel?
And is there another (better) way of creating a module (for header 
generation) on the fly in scheme?


Cheers,
Jan-Peter
>From 40a1419a051402ee4bac6d8f7fa65e5b8353b815 Mon Sep 17 00:00:00 2001
From: Jan-Peter Voigt 
Date: Fri, 2 Mar 2012 09:54:20 +0100
Subject: [PATCH] add ly:book-set-header!

Add a scheme function ly:book-set-header! like ly:score-set-header!

Function is copied from score-scheme.cc to book-scheme.cc,
setting public member var header_ in class Book.
---
 lily/book-scheme.cc |   13 +
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/lily/book-scheme.cc b/lily/book-scheme.cc
index 7f1026a..ae505af 100644
--- a/lily/book-scheme.cc
+++ b/lily/book-scheme.cc
@@ -156,6 +156,19 @@ LY_DEFINE (ly_book_header, "ly:book-header",
   return b->header_ ? b->header_ : SCM_BOOL_F;
 }
 
+LY_DEFINE (ly_book_set_header_x, "ly:book-set-header!",
+   2, 0, 0, (SCM book, SCM module),
+   "Set the book header.")
+{
+  LY_ASSERT_SMOB (Book, book, 1);
+  SCM_ASSERT_TYPE (ly_is_module (module), module, SCM_ARG2, __FUNCTION__,
+   "module");
+
+  Book *b = unsmob_book (book);
+  b->header_ = (module);
+  return SCM_UNSPECIFIED;
+}
+
 LY_DEFINE (ly_book_scores, "ly:book-scores",
1, 0, 0, (SCM book),
"Return scores in @var{book}.")
-- 
1.7.0.4

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


Re: a Lyric Report (-> my GSoC project)

2012-03-31 Thread Jan-Peter Voigt
Dear Janek,

what a great list of improvements to look forward to. I solve these issues most 
times with lengthy overrides boxed in music-functions ... if there is a way of 
helping (testing?), let me know!

Cheers, Jan-Peter


Am 30.03.2012 um 20:17 schrieb Janek Warchoł:

> Dear Team,
> 
> i've just created a multi-issue bug report about Lyrics: see issues
> 2450 - 2462 
> (http://code.google.com/p/lilypond/issues/list?q=label:GSoC-LyricProject).
> I dedicate them to Valentin, as he was skeptical whether Lyrics in
> LilyPond need much improvement ;)
> I've set the owner of these issues to myself, because one of my two
> applications for Google Summer of Code will be about improving Lyrics
> in Lily - it would be troublesome if suddenly someone did the work for
> me!
> Feel free to comment on these issues (suggestions greatly
> appreciated!), but please don't do any coding unless my application is
> rejected (final decision will be known on April 20th).
> 
> thanks,
> Janek


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


templates and a little bit more

2012-04-05 Thread Jan-Peter Voigt

Dear community,

I bundled some extensions in a little package to try out. Some of these ideas 
might be interesting to include in lily.
Here is a start of some docs, but just a little bit. I am working on it ...
http://www.xn--schne-noten-tfb.de/?tabs=3,1

and here are the files to include.
http://www.xn--schne-noten-tfb.de/lalily.tgz

If extract you this tar-gzip archive, you will get 3 files and one folder: 
lalily.ly, lalily.ily, lalily/ and alta-trinita.mus.ly. The alta-trinita-file 
is an example, the other three parts are the framework.
You only need to include lalily.ly - that file will include lalily.ily, if it 
hasn't done yet (include once). The ily-file will include some more files it 
finds on designated places, add the scheme-stuff to the guile-load-path and 
load some modules.
It *should* work, if you include from another folder like \include 
"my/downloaded/extensions/lalily.ly", but here it lives in a folder, wich is on 
the include path via the -I option ... in a shell scipt ...
I will start over later. What I wished to say is: That is not tested very well.
If you try this, you might wonder, what else are all these files doing ... they 
are a grown collection of things I use and are doing a lot of things.
I will gladly take parts and include them in a lily patch and I will gladly 
answer questions on them.
First of all, your harddisk will *not* be scanned and those informations are 
*not* sent to any secret service ;-)
But it looks for files lalily-templates.ly and lalily-config.ly in the current 
folder. And looks for files templates.*.ly, paper.*.ly and layout.*.ly in the 
layout folder.
And it sometimes creates a .log-file with some infos about the music stored.

A short addition to the website ... another example:

--snip--
\version "2.15.35"
\include "lalily.ly"

% register a template
\registerTemplate #'(my template) #(define-music-function (parser location 
piece options)(list? list?)
  #{
<<
\new Staff \with {
  % use option for instrument name
  instrumentName = $(assoc-get 'name options "N/A" #f )
} \getMusic #'(music) % get music from '(... music)
% call a template relative to this one ->  '(my template sub) with music in 
path '(... second)
\callTemplate #'(sub) #'(second) $options
  >>
#})
% register a template
\registerTemplate #'(my template sub) #(define-music-function (parser location 
piece options)(list? list?)
#{
  % get music from current folder
  \new Staff \getMusic #'()
#})

% set template for a 'folder' - sets the current folder
\setDefaultTemplate #'(test) #'(my template) #'((name . "hello"))
% set title for current folder
\setTitle "Hello World"
% store music in '(test music)
\putMusic #'(music) \relative c' {
  c4 e g b
}
% store music in '(test second)
\putMusic #'(second) \relative c' {
  g4 c e g
}

% create PDF, MIDI and a log-file
\lalilyTest
--snip--

I'd like to add my template mechanism to lily and probably some more of my 
ideas.
What do you think about this?

The next days I might not answer directly - well I will still have look at my 
emails. But next tuesday I will be back again.

Tomorrow we might have a silent minute or what else is to say.
And then happy easter to you!
Cheers, Jan-Peter



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


Re: templates and a little bit more

2012-04-06 Thread Jan-Peter Voigt

Am 06.04.2012 um 13:17 schrieb Janek Warchoł:

> On Thu, Apr 5, 2012 at 7:37 PM, Jan-Peter Voigt  wrote:
>> Dear community,
>> 
>> I bundled some extensions in a little package to try out. Some of these
>> ideas might be interesting to include in lily.
>> Here is a start of some docs, but just a little bit. I am working on it ...
>> http://www.xn--schne-noten-tfb.de/?tabs=3,1
> 
> I'm sorry that i don't have time to dig deeper,
Thats OK - I hope that you will be successful with your GSoC project! And that 
your exams don't suffer too much ;-)
> but my first
> impression is that it's somewhat similar to OrchestralLily:
> http://lac.linuxaudio.org/2010/papers/25.pdf
> http://reinhold.kainhofer.com/orchestrallily/A-simple-example.html#A-simple-example
> - it may give you some inspiration.
Yes I know orchestralily.

> 
> Generally speaking, i'd very much linke to simplify writing LilyPond
> scores.  Have you read my article "LilyPond's future"?
> (http://news.lilynet.net/?The-LilyPond-Report-25&lang=en#lilypond_s_future)
> What do you think about it?
I read it and I like it. It is a reason to send my stuff to the list, because I 
think, my ideas might be helpful in this matter.
I will explain it a little bit more the next days.

Cheers, Jan-Peter
___
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel


Re: templates and a little bit more

2012-04-10 Thread Jan-Peter Voigt

On 06.04.2012 13:17, Janek Warchoł wrote:

On Thu, Apr 5, 2012 at 7:37 PM, Jan-Peter Voigt  wrote:

Dear community,

I bundled some extensions in a little package to try out. Some of these
ideas might be interesting to include in lily.
Here is a start of some docs, but just a little bit. I am working on it ...
http://www.xn--schne-noten-tfb.de/?tabs=3,1

I'm sorry that i don't have time to dig deeper, but my first
impression is that it's somewhat similar to OrchestralLily:
http://lac.linuxaudio.org/2010/papers/25.pdf
http://reinhold.kainhofer.com/orchestrallily/A-simple-example.html#A-simple-example
- it may give you some inspiration.
Yes, my template mechanism has a similar intention. And I think 
OrchestraLily is a great tool.

But here are two points I wanted to solve differently:
1.: Orchestralily uses "normal" lilypond-variables to store and organize 
the music. An advantage is a quite simple input.
But a question, I had and read several times on this list remains, why 
and how to deal with the strict naming rules for lily-vars.
So I started storing music in scheme variables, to be able to use vars 
with a name verse1. Then I thought about the tree-like structure of 
music - Reinhold Kainhofer made a nice figure about this in his paper.
2.: I want to use normal music-functions for templates, so anything that 
fits in a music template, fits in a template. The JSON-like template 
syntax for oly is not my taste ;-)


The music is stored in a hash-tree-structure, wich uses a goops-class 
"tree" (found in lascm.scm):

--snip--
; ...
(define-class  ()
  (children #:accessor children #:init-thunk make-hash-table)
  (key #:accessor key #:init-keyword #:key #:init-value 'node)
  (value #:accessor value #:setter set-value! #:init-value #f)
)

(define-method (tree-set! (tree ) (path ) val)
  (if (= (length path) 0)
  (set! (value tree) val)
  (let* ((ckey (car path))
 (cpath (cdr path))
 (child (hash-ref (children tree) ckey))
)
(if (not (is-a? child ))
(begin (set! child (make  #:key ckey))
   (hash-set! (children tree) ckey child)
))
(tree-set! child cpath val)
  ))
  val)
; ...
(define-method (tree-get-tree (tree ) (path ))
  (if (= (length path) 0)
  tree
  (let* ((ckey (car path))
 (cpath (cdr path))
 (child (hash-ref (children tree) ckey))
)
(if (is-a? child )
(tree-get-tree child cpath)
#f)
)))
(define-method (tree-get (tree ) (path ))
  (let ((ctree (tree-get-tree tree path)))
   (if (is-a? ctree ) (value ctree) #f)))
; ...
--snip--
Hidden in a module '(lalily store) is a tree, to which music is stored 
with the \putMusic command. Also there is a "current music folder" var - 
I call it folder, because the term context is already reserved in lily, 
and this tree forms a file-system-like structure: \getMusic resolves the 
music stored in the tree in the given path relative to the current folder.

A template is music-function with a defined signature also stored in a tree:
\registerTemplate #'(generic) #(define-music-function (parser location 
piece options)(list? list?)

  ; location parameter for error messages, if music is not found
  (get-music piece location))

This tree-like structure allows several music pieces side by side. A 
collection of songs might lead to a tree:

chor/alta-trinita/music/sop
chor/alta-trinita/text/sop
chor/alta-trinita/music/alt
chor/alta-trinita/text/alt
...
chor/horianna/music/sop
chor/hosianna/text/sop
...

Then, when calling a template for satb-choral music, you give paths 
'(chor alta-trinita) and '(chor hosianna). This will fetch the music 
from the store as needed.
If a template is called with \callTemplate, the current folder and the 
current template are set accordingly on a path-stack and reset when the 
template-function returns.
So writing a template means writing a scheme-function. That is not 
simplifying input in the first place. And storing music means using a 
scheme-list as a path. This also is not simplifying the input - in the 
first shot.
But it divides input in storing music and calling a template. This is an 
advantage for automation and it simplifies input, if one can input 
scheme-values, which are used in several places in lily (e.g. pairs in 
markup-overrides).
And a template can loop over the music - I use this in the "choral-lied" 
templates to create a Lyrics-context for each verse. Writing a template 
may get confusing, but if a template needed is at hand, typesetting 
music can be reduced almost to input the notes.
For a music folder, a template to use can be stored. A template can call 
another template relative to its own path, so if you have a template 
'(lead-sheet), it might recursively call a template '(lead-sheet lyrics).
I also implemented 

Re: templates and a little bit more

2012-04-11 Thread Jan-Peter Voigt

Hello list,

if someone has loaded and tried my files on a windows machine, they 
probably didn't compile.
So I uploaded a new version, which should compile on windows - well it 
did not on an old W2k machine, I could use to test ... and so I changed 
some things regarding the scheme-function (getcwd).


http://www.xn--schne-noten-tfb.de/lalily.tgz

Cheers, Jan-Peter

On 10.04.2012 13:52, Jan-Peter Voigt wrote:

On 06.04.2012 13:17, Janek Warcho? wrote:

On Thu, Apr 5, 2012 at 7:37 PM, Jan-Peter Voigt  wrote:

Dear community,

I bundled some extensions in a little package to try out. Some of these
ideas might be interesting to include in lily.
Here is a start of some docs, but just a little bit. I am working on it ...
http://www.xn--schne-noten-tfb.de/?tabs=3,1

I'm sorry that i don't have time to dig deeper, but my first
impression is that it's somewhat similar to OrchestralLily:
http://lac.linuxaudio.org/2010/papers/25.pdf
http://reinhold.kainhofer.com/orchestrallily/A-simple-example.html#A-simple-example
- it may give you some inspiration.
Yes, my template mechanism has a similar intention. And I think 
OrchestraLily is a great tool.

But here are two points I wanted to solve differently:
1.: Orchestralily uses "normal" lilypond-variables to store and 
organize the music. An advantage is a quite simple input.
But a question, I had and read several times on this list remains, why 
and how to deal with the strict naming rules for lily-vars.
So I started storing music in scheme variables, to be able to use vars 
with a name verse1. Then I thought about the tree-like structure of 
music - Reinhold Kainhofer made a nice figure about this in his paper.
2.: I want to use normal music-functions for templates, so anything 
that fits in a music template, fits in a template. The JSON-like 
template syntax for oly is not my taste ;-)


The music is stored in a hash-tree-structure, wich uses a goops-class 
"tree" (found in lascm.scm):

--snip--
; ...
(define-class  ()
  (children #:accessor children #:init-thunk make-hash-table)
  (key #:accessor key #:init-keyword #:key #:init-value 'node)
  (value #:accessor value #:setter set-value! #:init-value #f)
)

(define-method (tree-set! (tree ) (path ) val)
  (if (= (length path) 0)
  (set! (value tree) val)
  (let* ((ckey (car path))
 (cpath (cdr path))
 (child (hash-ref (children tree) ckey))
)
(if (not (is-a? child ))
(begin (set! child (make  #:key ckey))
   (hash-set! (children tree) ckey child)
))
(tree-set! child cpath val)
  ))
  val)
; ...
(define-method (tree-get-tree (tree ) (path ))
  (if (= (length path) 0)
  tree
  (let* ((ckey (car path))
 (cpath (cdr path))
 (child (hash-ref (children tree) ckey))
)
(if (is-a? child )
(tree-get-tree child cpath)
#f)
)))
(define-method (tree-get (tree ) (path ))
  (let ((ctree (tree-get-tree tree path)))
   (if (is-a? ctree ) (value ctree) #f)))
; ...
--snip--
Hidden in a module '(lalily store) is a tree, to which music is stored 
with the \putMusic command. Also there is a "current music folder" var 
- I call it folder, because the term context is already reserved in 
lily, and this tree forms a file-system-like structure: \getMusic 
resolves the music stored in the tree in the given path relative to 
the current folder.
A template is music-function with a defined signature also stored in a 
tree:
\registerTemplate #'(generic) #(define-music-function (parser location 
piece options)(list? list?)

  ; location parameter for error messages, if music is not found
  (get-music piece location))

This tree-like structure allows several music pieces side by side. A 
collection of songs might lead to a tree:

chor/alta-trinita/music/sop
chor/alta-trinita/text/sop
chor/alta-trinita/music/alt
chor/alta-trinita/text/alt
...
chor/horianna/music/sop
chor/hosianna/text/sop
...

Then, when calling a template for satb-choral music, you give paths 
'(chor alta-trinita) and '(chor hosianna). This will fetch the music 
from the store as needed.
If a template is called with \callTemplate, the current folder and the 
current template are set accordingly on a path-stack and reset when 
the template-function returns.
So writing a template means writing a scheme-function. That is not 
simplifying input in the first place. And storing music means using a 
scheme-list as a path. This also is not simplifying the input - in the 
first shot.
But it divides input in storing music and calling a template. This is 
an advantage for automation and it simplifies input, if one can input 
scheme-values, which are used in several places in lily (e.g. pairs in 
markup-overrides).
And a template can loop over the music - I use this in the 
"choral-lied" templates to cr

Re: shape and chords

2012-06-20 Thread Jan-Peter Voigt

Hi David,

... moving this to devel ...
I had a look into "tie-column.cc":
In the scheme-callback "calc_positioning_done" all ties in a chord are 
assigned control-points in a loop. So it might be possible to define a 
scheme-callback "calc_control_point_column", that returns a list of a 
list of a list ... that returns all control-point-lists from the 
Tie_column. If it is not a column, say one tie, it might still return a 
list of this one tie.
This is just a thought - it might have implications or whatever fiddling 
with those files ...

My intention is: I would like to shape all ties in a chord.

Best, Jan-Peter

On 20.06.2012 01:27, David Nalesnik wrote:

Hi Jan-Peter,


It should be fairly straightforward to define a command to
operate on unbroken/broken stacks of ties, and I can look into this.



Oops, I spoke too soon!  There's a known issue about this 
http://www.lilypond.org/doc/v2.15/Documentation/notation/modifying-shapes:


It is not possible to modify shapes of ties or slurs by changing the 
|control-points| property if there are multiple ties or slurs at the 
same musical moment – the |\tweak| command will also not work in this 
case. However, the |tie-configuration| property of |TieColumn| can be 
overridden to set start line and direction as required.


That's unfortunate :(



2. In the development version warnings were given and a color
was used to indicate a mismatch of offset count and number of
curves in a broken one. What is the reason to not include
that into the release?

My thinking here was to get the basic functionality into the code
base, and these warnings are helpful but not strictly necessary.
  (They were designed to be part of a slur-editing tool and might
be more suitable for now as an enhancement on the LSR--opinions
welcome!)

That sounds reasonable. But probably there is room for a
"backdoor" to switch it on or plug in some kind of callback - a
context property(?) - so there's no need to copy the whole
function to LSR - now that it's already in the codebase ;-) ...
just a thought.


I'll have to think about this some.  The issue I see is that the 
version which reports mismatches depends on the location argument of 
the music function for the error message.



For now, thanks again for this amazing helper :-)


You're very welcome!  Thanks to everybody who helped get it to this stage!
Best,
David






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


Re: GSOC: change XY-extent to outer-XY-extent and inner-XY-extent (design - feedback requested)

2012-06-20 Thread Jan-Peter Voigt

Hi Janek,

there has been discussion on your patch.
I see your point, that you want to discriminate graphical, logical and 
perhaps some other extents. I also agree with Keith, that we shouldn't 
fill our RAM with redundant or unused data.
What about an extent-map, where extents can be stored by key? And 
propably there is already a usable map (GROB-properties?)?
The idea of having different extent-sizes may reduce the scheme-coding 
necessary for several things besides lyrics, like the subito f you 
mentioned for example. I use a lot of code, to align things like that 
correctly ... I will not post it here, because its too hackish ;-)


Cheers, Jan-Peter



On 19.06.2012 20:00, Janek Warchoł wrote:

On Tue, Jun 19, 2012 at 12:15 AM, Janek Warchoł
 wrote:

On Mon, Jun 18, 2012 at 6:29 PM, Joe Neeman  wrote:

The only difference is that I'm proposing
to make it possible to define aligned_on_y_parent in scheme, given that
aligned_on_parent is defined in C++. This part is basically what will allow
us to avoid hard-coding a single name (like "core-extent") into the C++
code.

What about giving more power to alignment properties?  Currently
self-alignment-[XY] is quite limited - you cannot specify parent and
child alignment separately, you cannot specify which parent you want,
and the name is confusing (after all, when aligned-on-[xy]-parent is
used, parent's extent matters, too).
I hope to cook a draft demonstrating this tomorrow.

Here's the patch:
http://codereview.appspot.com/6308093/
Please let me know what you think!

cheers,
Janek

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





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


Re: shape and chords

2012-06-25 Thread Jan-Peter Voigt

Hi David,

this is a solution for unbroken TieColumns - great! This will be useful!

On 25.06.2012 00:42, David Nalesnik wrote:

Hi Jan-Peter,

On Wed, Jun 20, 2012 at 2:46 AM, Jan-Peter Voigt <mailto:jp.vo...@gmx.de>> wrote:


Hi David,

... moving this to devel ...
I had a look into "tie-column.cc":
In the scheme-callback "calc_positioning_done" all ties in a chord
are assigned control-points in a loop. So it might be possible to
define a scheme-callback "calc_control_point_column", that returns
a list of a list of a list ... that returns all
control-point-lists from the Tie_column. If it is not a column,
say one tie, it might still return a list of this one tie.
This is just a thought - it might have implications or whatever
fiddling with those files ...
My intention is: I would like to shape all ties in a chord.


At this point I unfortunately can't help with the C++ aspect of this. 
 Some experimentation did show me that it is possible to manipulate 
'control-points within a column of ties using Scheme, however.
This was the hint I was looking for in tie-column.cc. Interestingly the 
TieColumn, in contrast to the Tie, has to be overridden after the first 
note/chord.
The following function demonstrates roughly how this might be done. 
 It doesn't make allowance for broken ties yet and requires an entry 
for each tie.  You can use () to leave a tie as-is.


\version "2.15.40"

shapeTieColumn =
#(define-music-function (parser location offset-list) (list?)
  #{
\once \override TieColumn #'after-line-breaking =
  #(lambda (grob)
(let ((ties (ly:grob-array->list (ly:grob-object grob 'ties
  (for-each
(lambda (tie off)
  (if (pair? off)
  (set! (ly:grob-property tie 'control-points)
(map
  (lambda (x y) (coord-translate x y))
  (ly:tie::calc-control-points tie) off
 ties offset-list)))
  #})

{
   ~ q
  q ~
  \shapeTieColumn #'(
   ()
   ((0 . -0.25) (0.33 . -0.1) (0.67 . -0.1) (1 . -0.25))
   ((0 . 0.2) (0.33 . 0.4) (0.67 . 0.4) (1 . 0.2))
   ()
  )
  q
}

\layout {
  ragged-right = ##t
}




Now I tried, like you probably also already did, to include the code 
from shape:

--snip--

\version "2.15.40"

shapeTieColumn =
#(define-music-function (parser location offset-list) (list?)
   ;; taken from the shape command
   (define (shape-curve grob offsets)
 (let* ((orig (ly:grob-original grob))
(siblings (if (ly:spanner? grob)
  (ly:spanner-broken-into orig) '()))
(total-found (length siblings))
(function (assoc-get 'control-points
(reverse (ly:grob-basic-properties grob
(coords (function grob)))

   (define (offset-control-points offsets)
 (if (null? offsets)
 coords
 (map
  (lambda (x y) (coord-translate x y))
  coords offsets)))

   (define (helper sibs offs)
 (ly:input-message location "offsets = ~A" offs)
 (if (pair? offs)
 (if (eq? (car sibs) grob)
 (offset-control-points (car offs))
 (helper (cdr sibs) (cdr offs)))
 coords))

   ;; log
   (ly:input-message location "siblings = ~A" (length siblings))
   ;; we work with lists of lists
   (if (or (null? offsets)
   (not (list? (car offsets
   (set! offsets (list offsets)))

   (if (>= total-found 2)
   (helper siblings offsets)
   (offset-control-points (car offsets)

   #{
 \once \override TieColumn #'after-line-breaking =
 #(lambda (grob)
(let ((ties (ly:grob-array->list (ly:grob-object grob 'ties
  (for-each
   (lambda (tie off)
 (if (pair? off)
 (set! (ly:grob-property tie 'control-points)
   (shape-curve tie off)
   )))
   ties offset-list)))
   #})

{
  4 ~ q2
  q4 ~
  \shapeTieColumn #'(
 ()
 (((0 . -0.25) (0.33 . -0.1) (0.67 . 5) (1 . -0.25))
  ((0 . -0.25) (0.33 . -0.1) (0.67 . 5) (1 . -0.25)))
 ((0 . 0.2) (0.33 . 0.4) (0.67 . 0.4) (1 . 0.2))
 ()
 )
  \break
  q
}

\layout {
  ragged-right = ##t
}
--snip--


Now the broken siblings are found, but only the first one is shaped.
But it seems possible ... I will have another look after lunch ;-)

Cheers, Jan-Peter


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


label and page-ref within music

2011-01-14 Thread Jan-Peter Voigt
Hello List,

I stumbled across a thing with label and page-ref.
Labels are used to create the table of contents and I use them in my little 
footnote snippet ( http://lsr.dsi.unimi.it/LSR/Item?id=728 )
If the label is created on a barline, everything is fine. if it is created 
somewhere within  a measure, the page is not found anymore. I show this with 
\tocItem, because its a short snippet:

--snip--
\markuplines \table-of-contents

\relative c' {
  \time 4/4
  \tocItem \markup { "One" } c d % page 1
  \tocItem \markup { "Two" } e f % page not found
  \time 3/4
  \tocItem \markup { "Three" } g a b c % page one
  \tocItem \markup { "Four" } r2 % page not found
}

\version "2.13.46"
--snip--
I tested it with stable (2.12.3) and unstable (2.13.46) on Linux and Mac.
In my little snippet I create, like the tocItem command, a label-event in 
scheme:
...
;; define label and text before this
...
(make-music 'EventChord 'page-marker #t 'page-label label 
  'elements (list
(make-music 'LabelEvent 'page-label label)
(make-music 'TextScriptEvent 'direction dir 'text (markup text))
  )
)
...
When I later try to fetch the page-number from the lable-table 
(ly:output-def-lookup layout 'label-page-table), the table does not contain an 
entry label if it was *not* created on a barline.
What do you think about this?

I post this to user and devel, so if there is a solution or explanation let me 
know, if this is a bug discuss it for the bug-tracker.

Regards,
Jan-Peter


___
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel


when/where/wy is a label for page-ref created?

2011-01-17 Thread Jan-Peter Voigt

Hello list,

I searched for an explanation in my lilybuntu VM for label creation and 
referencation. There are several .cc files wich reference labels etc. 
But I didn't find the place where they are added and under wich conditions.
I wish to be able to add labels independent of breaks or bar-lines. Do I 
have to create a patch for my lily - and where do I have start with 
that? Or is it just a question of another scheme-script?


If I do a \displayMusic for
{ \bar "" \tocItem \markup { "A" } }
I get:
(make-music
  'SequentialMusic
  'elements
  (list (make-music
  'ContextSpeccedMusic
  'context-type
  'Timing
  'element
  (make-music
'PropertySet
'value
""
'symbol
'whichBar))
(make-music
  'EventChord
  'elements
  (list (make-music
  'LabelEvent
  'page-label
  'toc54))
  'page-label
  'toc54
  'page-marker
  #t)))

In my footnote-function I added the 'wichbar-part and now I can create 
the label anywhere. But this may lead to unwanted breaks or override an 
exisitng barline. How do I avoid this? Or is there a better solution?


Best regards,
Jan-Peter

On 14.01.2011 14:27, Jan-Peter Voigt wrote:

Hello List,

I stumbled across a thing with label and page-ref.
Labels are used to create the table of contents and I use them in my little 
footnote snippet ( http://lsr.dsi.unimi.it/LSR/Item?id=728 )
If the label is created on a barline, everything is fine. if it is created 
somewhere within  a measure, the page is not found anymore. I show this with 
\tocItem, because its a short snippet:

--snip--
\markuplines \table-of-contents

\relative c' {
   \time 4/4
   \tocItem \markup { "One" } c d % page 1
   \tocItem \markup { "Two" } e f % page not found
   \time 3/4
   \tocItem \markup { "Three" } g a b c % page one
   \tocItem \markup { "Four" } r2 % page not found
}

\version "2.13.46"
--snip--
I tested it with stable (2.12.3) and unstable (2.13.46) on Linux and Mac.
In my little snippet I create, like the tocItem command, a label-event in 
scheme:
...
;; define label and text before this
...
(make-music 'EventChord 'page-marker #t 'page-label label
   'elements (list
 (make-music 'LabelEvent 'page-label label)
 (make-music 'TextScriptEvent 'direction dir 'text (markup text))
   )
)
...
When I later try to fetch the page-number from the lable-table 
(ly:output-def-lookup layout 'label-page-table), the table does not contain an 
entry label if it was *not* created on a barline.
What do you think about this?

I post this to user and devel, so if there is a solution or explanation let me 
know, if this is a bug discuss it for the bug-tracker.

Regards,
Jan-Peter


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




___
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel


Re: when/where/wy is a label for page-ref created?

2011-01-17 Thread Jan-Peter Voigt

Hello Neil,

thank you very much! With your patch "loose" labels are not pruned.
I will have deeper look into it tomorrow to learn more about the 
C++-part of my cute lily ;-)
But first I will prepare a new version of my snippet, where it shows 
asterisks/stars instead of numbers, wich is the way I saw it in most 
scores I sung.
It should'nt be too difficult to parametresize it to use symbols or 
numbers. I am thinking of another version, wich collects such numbered 
comments like a table of comments to be inserted at the end of the book 
(or somewhere else, see Dana Emerys comment to issue 737).
My footnote snippet can only contain (small) markups in a reserved space 
on the page. But well - it is a start ;-)


I really would enjoy a ride through the process of label addition. But 
to be honest, I think I have to dive a lot deeper through the main 
processes to get a deeper insight of the whole concept. These are first 
steps in lily/*.cc ;-)



best regards,
Jan-Peter


On 17.01.2011 18:24, Neil Puttock wrote:

On 17 January 2011 14:53, Jan-Peter Voigt  wrote:


I searched for an explanation in my lilybuntu VM for label creation and
referencation. There are several .cc files wich reference labels etc. But I
didn't find the place where they are added and under wich conditions.
I wish to be able to add labels independent of breaks or bar-lines. Do I
have to create a patch for my lily - and where do I have start with that? Or
is it just a question of another scheme-script?

(I had a draft reply ready from your original thread, so I've replied
there first.)

I can run through the process of label addition if you'd like to know
how it works, but in the meantime, attached is a patch which fixes
this bug (I'll post a final patch for review later this evening).

Cheers,
Neil



___
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel


Re: Using lyrics in a markup

2011-01-23 Thread Jan-Peter Voigt
Hello and thank you Jakob, hello list,

this piece is a great work. It compiles well in 2.13(.47 lilybuntu) and adds a 
very useful function to lily!
The .ly is attached again, because I think it is good to have it on the 
devel-list.
I would like to add it to LSR to have it in the main distro once. But it 
doesn't compile in 2.12(.3) stable, so it can't be uploaded right now.
What else should we do now?

Lilypond 2.12 complains about these lines:
...
#(define-markup-command (verse layout props lyrics) (ly:music?)
#:properties ((display-nl #f)
(make-line make-justify-markup))
...

by the way: Is this #:properties(()) notation a new functionality in 2.13? I 
haven't seen it before?
And is there a tutorial on all those comma- and accent-notations like in 
\override #`(make-line . ,make-wordwrap-markup) ?
I haven't found it in my scheme-tutorials.

Best regards,
Jan-Peter.

Am 23.01.2011 um 14:15 schrieb jakob lund:

> oops, forgot to reply to list (sorry about the extra spam Jan-Peter)
I don't mind ;-)
> 2011/1/23 jakob lund :
>> Hi again
>> 
>> After fiddling some more with this, I came up with a simple solution.
>> Instead of a string, a LineBreakEvent is inserted into the lyric --
>> neither \lyricmode or \addlyrics complain about this, and the events
>> doesn't seem to appear in the music output. This removes the need for
>> the filter function.
>> 
>> The lyrics->list function then recognizes the placeholders and
>> replaces them with occurrences of the indicator string, which the
>> verse command then uses to split the lines.
>> 
>> It seems to work well, try it out.
>> 


lyrics-to-text.ly
Description: Binary data
___
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel


Re: markup to string function?

2011-01-27 Thread Jan-Peter Voigt

Hello Reinhold,

I'm a bit in a hurry, so this is not finished but an idea:

I thought of my fine conversation about extracting lyrics with Jakob 
Lund a few days ago. I understand that markups are also lists and the 
strings are somewhere in this tree-list-structure.


This doesn't get you the desired result, but perhaps you can finish this.
--snip--
\version "2.12.3"

#(define (markup->string m)
(let ((res ""))
 (map (lambda (x)
  (display "> ")(display x)(display "\n")
  (if (list? x)(set! res (string-append res 
(markup->string x

  (if (string? x)(set! res (string-append res x)))
  (display "! ")(display res)(display "\n")
  res)
  m) res))

ttt = \markup {
  \normal-text hallo \bold { welt }
}

#(display (markup->string ttt))

\header {
  title = \ttt
}
\relative c' {
  c
}
--snip--
With this bunch of displays, you see what is in the markup. There is a 
string concatenated, but it will leave all blanks so this "hallo welt" 
will get "hallowelt".

Just inserting blanks doesn't care about concats ...

Best regards,
Jan-Peter


On 26.01.2011 16:32, Reinhold Kainhofer wrote:

I'm currently implementing PDF metadata (DOCINFO extracted from the \header
fields) as well as PDF hyperlinks to given labels in the score. For both I
would need to extract a pure-string representation of a given markup. E.g.,
the title header field might be a markup:

\header{
   title = \markup { \italic "Title of " \bold \concat {"the" " " "piece"} }
}

Now, given that markup, I need a function that extracts only the text (in this
case "Title of the piece"). Is there anything like that already available in
lilypond?

If not, do you have any idea about the easiest way to implement this? It's
safe to ignore all graphical markup functions, but there are so many text
markup functions that I can not easily handle each of them manually...

Any ideas?

Thanks,
Reinhold



___
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel


Re: markup to string function?

2011-01-28 Thread Jan-Peter Voigt

Hello again,

maybe my answer is a bit off your topic, because I think you are looking 
for a C function. But still, markups are lists in scheme, so you might 
use libguile to access this function in C:


--snip--
#(define (markup->string mup conc)
(let ((result ""))
 ;;(display "(")
 (map (lambda (x)
  (begin
;;(display "> ")(display conc)(display "\n")
(if (eq? x concat-markup)(set! conc #t))
(if (list? x)
(set! result
  (if (or conc (string=? result ""))
  (string-append result 
(markup->string x conc))
  (string-append result " " 
(markup->string x conc)

(if (string? x)
(set! result
  (if (or conc (string=? result ""))
  (string-append result x)
  (string-append result " " x
result))
  mup)
 ;;(display ")")
 result)
)
#(define-markup-command (plain-text layout props arg)(markup?)
(interpret-markup layout props (markup 
(markup->string arg #f


ttt = \markup { \italic "Title of " \bold \concat {"the" " " "piece"} }

\header {
  title = \ttt
  subtitle = \markup { \normal-text { \italic { \plain-text \ttt } } }
}
\relative c' {
  c
}
--snip--

Regards,
Jan-Peter


___
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel


Re: Scheme : compiling text and score sequences

2011-02-09 Thread Jan-Peter Voigt



It may be totally unrelated but that reminds me of this:
http://lists.gnu.org/archive/html/bug-lilypond/2010-12/msg00425.html

Cheers,
Xavier


Hi Xavier,

this is related to the footnote snippet ... if you have footnotes at a 
pagebreak, the footnote might be on the wrong page. For these endnotes 
it would mean, that if you display page-numbers, they might be incorrect.

Well AFAICS it is unrelated to the ordering problem.

Cheers, Jan-Peter


___
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel


Re: Scheme : compiling text and score sequences

2011-02-10 Thread Jan-Peter Voigt

Hello,

to work with foot- or end-notes its good to know the current position in 
music - of course this doesn't make sense for a paragraph of pure text ;-)
So I digged for a way to fetch the current position in music - these are 
only some hints for me to remember and perhaps for you to try:

--snip--
\version "2.12.3"

show = #(define-music-function (parser location name) (string?)
  (make-music 'ApplyContext
'origin location
'procedure
(lambda (c)
(let*
  ((cbn (ly:context-property c 'currentBarNumber))
   (cbn (if (not (number? cbn)) 0 cbn))
   (cmp (ly:context-property c 'measurePosition)))
  (display name)
  (display (format " Measure ~a at ~a/~a (~a/~a)\n"
 cbn
 (ly:moment-main-numerator cmp)
 (ly:moment-main-denominator cmp)
 (ly:moment-grace-numerator cmp)
 (ly:moment-grace-denominator cmp)))



music = #(define-music-function (parser location name) (string?)
  #{
\relative c' {
  \show #$name s1*0 \show #$name c2. \show #$name r4 d \show #$name 
e \show #$name f

}
#})

\score {
<<
\music #"A"
{ s2. \music #"B" }
>>
}
--snip--
This simply prints out the current position in the music. The name 
string is for looking at the order of processing the music.


I will have another look on this later.

Best regards,
Jan-Peter


On 09.02.2011 22:38, Bertrand Bordage wrote:

Thanks Jan-Peter !

I agree with your idea of using asterisks instead of numbers when 
annotating scores (but for text, numbers seems more elegant).

For the moment, I will try to do LaTeX-like footnotes for markuplines.

Indeed, this would be a good solution for now :
- A column of footnotes on each page of markuplines
- Endnotes for the musical parts. Maybe without any sign on the score, 
but with a reference to the score name, the current bar number and the 
instrument name in the list of endnotes, like in Ricordi's critical 
notes. This will avoid the parallel music parsing issue. And it looks 
sooo classy ;-)  (or boring)


Then I'll have a deeper look on this parsing issue.

Any help would be welcome :o)

Regards,
Bertrand



___
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel


scheme system stdout and markup predicates

2011-08-23 Thread Jan-Peter Voigt

Hello List,

I am using the scheme system command (on linux) to generate barcodes to 
include in the PDF:

--snip--
\version "2.14.2"

% use barcode command to produce temporary eps and include it
#(define-markup-command (barcode layout props type str size 
nums)(string-or-symbol? string? number-pair? boolean?)

  (let ((width (car size))
(height (cdr size)))
   ; create temporary file name and empty stencil
   (let ((tmp (format "~A-~2A.eps" (strftime "%Y%m%d%H%M%S" 
(localtime (current-time))) (random 100)))
 (barcode-stencil (interpret-markup layout props (markup 
#:with-color red #:filled-box (cons 0 width) (cons 0 height) 0.7

; if str is a symbol like 'header:ismn get the property
(if (symbol? str)(let ((tmp (chain-assoc-get str props #f)))
 (if tmp (set! str tmp
; execute command
(system (format "barcode ~A -e \"~A\" -g ~Ax~A+0+0 -o 
\"~A\" -E -b \"~A\"" (if nums "" "-n") type (* 100 width) (* 100 height) 
tmp str))

; create EPS stencil
(set! barcode-stencil (eps-file->stencil X (car size) tmp))
; remove temporary file
(system (format "rm -v \"~A\"" tmp))
barcode-stencil
)))

% define stencil cache, to produce it only once, when used several times 
e.g. in footer markup

#(define-public (get-stencil symbol) #f)
#(define-public (put-stencil symbol stencil) #f)
#(define-public (rem-stencil symbol) #f)
#(let ((cache (list)))
 (set! put-stencil (lambda (symbol stencil)
   (set! cache (assoc-set! cache symbol stencil))
   stencil))
 (set! get-stencil (lambda (symbol)
   (assoc-get symbol cache)))
 (set! rem-stencil (lambda (symbol)
   (set! cache (assoc-set! cache symbol #f))
   empty-stencil))
)
#(define-markup-command (cache layout props sym text)(symbol? markup?)
  (let ((stencil (get-stencil sym)))
   (if (not stencil)
   (set! stencil (interpret-markup layout props text)))
   (put-stencil sym stencil)
   stencil)
)
#(define-markup-command (cache-clear layout props sym)(symbol?)
  (rem-stencil sym)
)

% include ISMN barcode
\markup \column {
  \cache #'ismn \barcode #"EAN" #"97900121" #'(30 . 8) ##t
  \cache #'ismn \barcode #"EAN" #"97900122" #'(35 . 8) ##t
  \cache-clear #'ismn
  \cache #'ismn \barcode #"EAN" #"97900123" #'(40 . 8) ##t
}
--snip--

I have two questions:
To (system "...")
1: There are several commands, wich can write the generated EPS to 
stdout. Is there a possibility to catch that and integrate it without 
creating a temporary file?

2: Is there a way to get the result code and see if the command succeded?

Now have fun, playing around with (system "echo Hello World")!

Cheers,
Jan-Peter


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


Re: scheme system stdout and markup predicates

2011-08-23 Thread Jan-Peter Voigt

Hi David

I have two questions:
To (system "...")
1: There are several commands, wich can write the generated EPS to
stdout. Is there a possibility to catch that and integrate it without
creating a temporary file?

See the guile documentation, node "Pipes".

OK, thanks!

2: Is there a way to get the result code and see if the command succeded?

Uh, have you even looked up "system" in the guile documentation?
Yes I have ... but I typed my question a bit to fast ... the question 
should have been, why does '(if (not (system ...' not act, like I would 
expect. But with '(if (= 0 (system ...' it does.

Sorry for the noise!

Cheers,
Jan-Peter


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


xelatex text block in markups

2011-09-01 Thread Jan-Peter Voigt

Hello lists,

I made up a markup command, to include latex-formatted text. Well, I 
don't want to "get rid of lilypond-book" like some people wrote on this 
list, but I want the oppertunity, to include a well formatted text on my 
first page of a book with several pieces of music.
I used to take http://lsr.dsi.unimi.it/LSR/Snippet?id=586 for making 
paragraphs. But that one lacks hyphenation (in this example, hyphenation 
fails in some lines, but thats a xelatex issue) and doesn't look as 
balanced as latex generated output.
And I haven't found a way, to produce two column output with 
markup-lines (did I overlook something?).


So here is what I do:
- create a temporary tex-file from a markup with paper size set with the 
geometry package

- process it with xelatex (from texlive 2009 on ubuntu lucid)
- convert it with pdftops (from texlive 2009 on ubuntu lucid)
- return the eps-stencil

Now this is just a proof of concept, trial or whatever.
Problems for now:
- The paragraph command is able to pagebreak, this include variant isn't 
- right now.

- The height of the resulting text-box has to be found by trial and error.
- Dependency on unrelated software
TBD: error checks

Does anybody has quick answer to the following questions?
- How can I determine the page height in staff-space or cm?
Not lilypond-related, but probably someone knows ;-)
- How can I crop an EPS to the actually visual size

If I have answers to these questions, I could detetermine the page-count 
of the temporary pdf and create -[1...].eps files and create a 
markup-list-command.


Well, probably one should use lilypond-book, produce the lilypdf and 
include that in another PDF with an external tool or use the snippet 
mentioned above.
But I also thought about using this technique to improve e.g. 
footnote-markups (with hyphenation etc...).


What do you think? Suggestions welcome.
Cheers, Jan-Peter

\version "2.14.2"

% This example assumes an environment with xelatex and pdftops available in PATH

% if set later, paperScale is not updated!
#(set-global-staff-size 16)

% how is the staff-scaling
#(define-public paperScale 1.0)
\paper {
  #(set! paperScale (/ (* 1 cm) staff-space))
}

% get a string from a markup
% TBD convert bold, italic, etc. to latex-commands
% (snippet taken from the list)
#(define (markup->string mup conc)
(let ((result ""))
 (map (lambda (x)
  (begin
;; if this is a concat-markup, do not insert blanks between string
(if (eq? x concat-markup)(set! conc #t))
(if (list? x)
(set! result 
  ;; if we are concatenating or we start with an empty result, don't add a blank
  (if (or conc (string=? result ""))
  (string-append result (markup->string x conc))
  (string-append result " " (markup->string x conc)
(if (string? x)
(set! result 
  ;; if we are concatenating or we start with an empty result, don't add a blank
  (if (or conc (string=? result ""))
  (string-append result x)
  (string-append result " " x
result))
  mup)
 result)
)
% xetex markup command (could also be done with pdflatex)
#(define-markup-command (xetex layout props size m)(number? markup-list?)
  (let (
 ; width of our box in cm
 (width (/ (chain-assoc-get 'line-width props 0) paperScale))
 ; height of our box in cm
 (height (/ size paperScale))
 ; the text to fill into template.tex
 (text (markup->string m #f))
 ; basename of working files
 (basename (strftime "xelatex-%Y%m%d%H%M%S" (localtime (current-time
 ; result of each command
 (result 0)
 ; stencil to return
 (text-stencil empty-stencil))
   ; write .tex
   (with-output-to-file (format "~A.tex" basename) (lambda ()
 (display (format "\\documentclass{scrartcl}
\\usepackage[paperwidth=~Acm,paperheight=~Acm,margin=1mm]{geometry}
\\usepackage[ngerman]{babel}
\\usepackage{fontspec}
\\setmainfont{DejaVu Sans}
\\begin{document}
~A
\\end{document}
" width height text
   ; produce pdf
   (set! result (system (format "xelatex \"~A.tex\"" basename)))
   ; convert first page to EPS
   (set! result (system (format "pdftops -eps -f 1 -l 1 \"~A.pdf\"" basename)))
   
   ; include EPS
   (set! text-stencil (eps-file->stencil Y size (format "~A.eps" basename)))
   ; remove working files
   (system (format "rm -v \"~A\".*" basename))
   ; return eps-stencil
   text-stencil
))

%

Re: maintaining advanced power-user Scheme functions

2013-08-20 Thread Jan-Peter Voigt

Hi there,

well, I didn't read all messages of this thread, but I see two points of 
discussion:

1. we already have LSR
2. who likes to use git?

1.: Well, we have LSR, but the current implementation needs a 
tomcat-server with mysql. I did use tomcat sometimes and created some 
webapps, but as a born pacifist I really don't like to call files *.WAR 
;) ok, no more joking!
This part is maintained by one(?) person and my impression is, that its 
not that easy to get in touch?
I know, every lily user can start the update, but wouldn't it be easier, 
if one, submitting a snippet, is upgrading it to the current stable version?

hm, but who is contacting whom to kick off the upgrade?
IMO we have something, but it would be very nice to optimize it.

2.: a) I like git ;)
b) thinking of a web front end, which uses GIT as a storage backend is 
(IMHO) not that bad.


3.: (a third point of disussion? Well, I just had a thought, which does 
not exactly fit the two former points ...)

I was thinking of building yet another snippet repository (YASR ;)
* The repository shall be searchable - like the current LSR
* The snippets shall be tagged, for which lily-version they work!
If one finds a snippet, not running in the lily-version he is actually 
using, he is able to post an updated version.
* If there is a scheme-snippet, it might not be useful, to produce any 
PDF/PNG but maybe text


But to create this, a lot of things have to work:
* Website with Database (searching) - this is made up easy, but can mean 
a lot of work
* ... and different running versions of lilypond - this propably forces 
a dedicated server, which means more administration


Just some thoughts

Cheers, Jan-Peter




Am 14.08.2013 14:34, schrieb Janek Warchoł:

Harm and David N. (and some other people) write lots of very advanced
(and very helpful!) Scheme functions.  These funcitons are improved
over time, and there is a problem related to that: it's easy to get
lost in all the email threads about them, and it's not always obvious
where the most recent version is.

I think that such functions should be tracked by version control, and
i see two approaches:
- include them in official LilyPond source as soon as they are
created.  Upside: there's bigger chance that they will be updated when
there are some changes. Downside: one has to write documentation and
go through official patch submitting channels.
- use another repository.  What about OpenLilyLib?http://www.openlilylib.org/

At any rate, we better do something about it - at current state, all
these funcitons can easily become lost or forgotten, and that would be
a grave loss.

+1


Thoughts?




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


Re: enhancement request - new header field: movement

2013-09-25 Thread Jan-Peter Voigt

Hi David,
lilypond has a header field "piece", which is meant for movement names. 
To have this field centered - default is left above the score - one has 
to modify scoreTitleMarkup in paper.
Perhaps other markups would be nice. (a markup is a template by itself, 
because it gets its title/coposer/etc names via \getProperty #'header:...)


HTH
Best, Jan-Peter


On 25.09.2013 13:39, bobr...@centrum.is wrote:

I've been wanting a "movement" field in LilyPond's headers.  I've managed to 
make something for myself that is working, more or less, but I'm sure it could be done 
much better by someone who actually knows what he's doing.  My idea is that it should be 
centered horizontally and be lower on the page than the other fields.  That is, the last 
header field before the printed music.  I think having the font the same as the title or 
maybe on size smaller would work well.

I think this would be of general utility for others as well.

-David

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



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


Re: enhancement request - new header field: movement

2013-09-26 Thread Jan-Peter Voigt

Hi Janek,

Am 26.09.2013 09:53, schrieb Janek Warchoł:

You mean it would be nice to add a few predefined header styles to
choose from?  I agree, and i have something that i could share,

me too ;)

but i'd like to first sort out our contribution policies (the "github 
discussion").
yes ... I do understand the objections against github. But its still 
usable to show, what one'd like to share ;)
IMO your and Urs affords in bringing in some kind of SSRfL (Schem 
Snippet Repo for Lilypond) brought up an important discussion. I read 
most of the discussion and hope it will end up in a more intuitive (or 
whatever ;) ) toolchain for contributors.


Best, Jan-Peter



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


Re: enhancement request - new header field: movement

2013-09-26 Thread Jan-Peter Voigt


Hi David,

Am 26.09.2013 10:08, schrieb David Kastrup:

Well, there is movement in there, where we'll explore the technical
tools that Savannah might provide us with and see where we might want to
take our infrastructure based on that.  I suppose it's more efficient to
stall discussion until we actually know which options are feasible using
which hosters as I think it desirable to stay close with Savannah where
feasible.
The important thing is: there is movement in the discussion and I really 
appreciate, that there is a discussion!

But still, I think that we can make a reasonably good case for Savannah
to consider trying new things if that proves desirable.

+1

Best, Jan-Peter


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


Re: converting music stream back to ly code

2013-11-16 Thread Jan-Peter Voigt
Hi Janek, David,

I have a fading memory, that Graham used the term "music stream" in the
context of his virtual violin:
http://percival-music.ca/usage.html

If you want to use that stream, you need to parse text ... hm, should be
possible to build some lilypond code from that ...

If you want to use the musical expressions, propably fetched by an
engraver, there is a function to serialize as scheme (I am not at my
desk right now ...) and IIRC also as lilypond code.

Best, Jan-Peter

On 15.11.2013 21:43, David Kastrup wrote:
> What do you call "its music stream representation"?  LilyPond does not
> have something like a music stream.  It has music expressions, and it
> can iterate them resulting in stream events in a certain order (and
> there is some event recorder for the part combiner and music quotes that
> can save those events).
>
> But there is nothing I'd call a "music stream representation".


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


Re: how close are we to having an "addAt" or "insertAt" feature?

2014-01-13 Thread Jan-Peter Voigt
Hi Kieren and all,

I use an engraver for this task, that looks for overrides, sets and
clefs at the current measure (of the context consisting this engraver)
and at the current moment inside this measure. So this is a little bit
different from your example in that it listens during compilation, while
your example modifies a music expression /before/ compilation.

My intention was the ability to use a pen and mark all grobs to modify
on a printed sheet of music - without any links to the source.
Now I just write

\editionMod {...}

and I can switch on and off the edition-overrides as needed.
This approach should be able to produce any grob, but beside overrides
and sets I have only implemented inserting clefs and TextScript-grobs.

To implement a function, that modifies the music expression without
compiling means, that you have to know the run of time-signatures. If
you don't know that, you don't know when measure X starts.
If you have a global variable for all time signatures, you might look
for all time-signature-events and accumulate them to produce a
skip-expression.

addAt =
#(define-music-function (parser location music measure moment
addition)(ly:music? integer? ly:moment ly:music?)
; ... create myAdd = { \skip #to-measure-moment $addition }
; and return
(make-music 'SimultaneousMusic 'elements (list music myAdd))
)

HTHOIALI (hth or is at least interesting)

Cheers,
Jan-Peter


Am 14.01.2014 00:03, schrieb Kieren MacMillan:
> Hello all,
> 
> What would be involved in developing a feature to add notes or tweaks at an 
> arbitrary moment within a music expression?
> 
> e.g.
> 
> global = \repeat unfold 100 s1
> music = \addAt (4 3/8) \global \once \override RehearsalMark.extra-offset 
> #’(-1 . 0)
> 
> where (4 3/8) means “in the fourth measure, at the moment of the 3rd eighth 
> note”
> 
> This would allow “perfect” separation of content from presentation — a very 
> welcome thing to my mind.
> 
> Thanks,
> Kieren.
> ___
> lilypond-devel mailing list
> lilypond-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/lilypond-devel
> 


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


Re: how close are we to having an "addAt" or "insertAt" feature?

2014-01-15 Thread Jan-Peter Voigt
Hi Kieren, James and all,

I extracted my edition-engraver from lalily. The example compiles here
with 2.18.
You can try this and comment ... I will add more comments to the code,
if this is of interest ;)

The compilation creates a file example.edition.log containing all
edition-engraver paths.

I use this inside lalily. There is always a current "music-path", which
is used to create the path for the engraver. Then the edition-engraver
paths are made by the template in use, so I don't have to deal with them.

HTH
Best, Jan-Peter


On 14.01.2014 14:46, James wrote:
> On 14/01/14 07:17, Jan-Peter Voigt wrote:
>> Hi Kieren and all,
>>
>> I use an engraver for this task, that looks for overrides, sets and
>> clefs at the current measure (of the context consisting this engraver)
>> and at the current moment inside this measure. So this is a little bit
>> different from your example in that it listens during compilation, while
>> your example modifies a music expression /before/ compilation.
>>
>> My intention was the ability to use a pen and mark all grobs to modify
>> on a printed sheet of music - without any links to the source.
>> Now I just write
>>
>> \editionMod {...}
>>
>> and I can switch on and off the edition-overrides as needed.
>> This approach should be able to produce any grob, but beside overrides
>> and sets I have only implemented inserting clefs and TextScript-grobs.
>>
>> To implement a function, that modifies the music expression without
>> compiling means, that you have to know the run of time-signatures. If
>> you don't know that, you don't know when measure X starts.
>> If you have a global variable for all time signatures, you might look
>> for all time-signature-events and accumulate them to produce a
>> skip-expression.
>>
>> addAt =
>> #(define-music-function (parser location music measure moment
>> addition)(ly:music? integer? ly:moment ly:music?)
>> ; ... create myAdd = { \skip #to-measure-moment $addition }
>> ; and return
>> (make-music 'SimultaneousMusic 'elements (list music myAdd))
>> )
>>
>> HTHOIALI (hth or is at least interesting)
>>
>> Cheers,
>> Jan-Peter
>
> Could you give a working .ly example?
>
> It might prove helpful for other users that cannot necessarily
> understand scheme (like me :) )
>
> Also if it compiles on 2.14 then we could add it to the LSR for other
> users.
>
> James

\version "2.18.0"
\include "util.ily"

#(use-modules (oop goops))

% custom string representation of a moment
#(define-public (moment->string mom)
  (if (ly:moment? mom)
  (let ((num (ly:moment-main-numerator mom))
(den (ly:moment-main-denominator mom))
(gnum (ly:moment-grace-numerator mom))
(gden (ly:moment-grace-denominator mom)))
(format "(~A/~A~A)" num den
  (cond
   ((> gnum 0)(format "+~A/~A" gnum gden))
   ((< gnum 0)(format "~A/~A" gnum gden))
   (else "")
   ))
)
  "(?:?)"
  ))

%
% class to store for example \set stanza = "1."

#(define-class  ()
  (once #:init-value #t #:accessor is-once #:setter set-once! #:init-keyword 
#:once)
  (symbol #:accessor get-symbol #:setter set-symbol! #:init-keyword #:symbol)
  (value #:accessor get-value #:setter set-value! #:init-keyword #:value)
  (previous #:accessor get-previous #:setter set-previous! #:init-value #f)
  (context #:accessor get-context #:setter set-context! #:init-keyword 
#:context)
  )
% apply set to context
#(define-method (do-propset context (prop ))
  (if (get-context prop)
  (let ((parctx (ly:context-find context (get-context prop
(if (ly:context? parctx) (set! context parctx
  (set-previous! prop (ly:context-property context (get-symbol prop)))
  (ly:context-set-property! context (get-symbol prop) (get-value prop))
  )
%(export do-propset)
% apply unset to context
#(define-method (reset-prop context (prop ))
  (if (get-context prop)
  (let ((parctx (ly:context-find context (get-context prop
(if (ly:context? parctx) (set! context parctx
  (ly:context-set-property! context (get-symbol prop) (get-previous prop))
  )
%(export reset-prop)

% predicate
#(define-public (propset? p)(is-a? p ))
% serialize to string
#(define-method (propset->string (ps ))
  (format "~A\\set ~A = ~A" (if (is-once ps) "once " "") (string-append (if 
(get-context ps) (format "~A." (get-context ps)) "") (format "~A" (get-symbol 
ps))) (get-value ps)))
%(export propset->string)
% implement display
#(define-method (display (o ) port) (display (propset->

Re: how close are we to having an "addAt" or "insertAt" feature?

2014-01-16 Thread Jan-Peter Voigt
Hi Kieren,

Am 16.01.2014 03:16, schrieb Kieren MacMillan:
> 1. What — if any — drawbacks are there?
- if you use it without any template mechanism, you have to assign
proper edition-engraver id-paths - I can't say, what that means in
production.
- right now it is just ripped out of my working framework and might or
might not work as expected ... but this doesn't need to be called a
drawback, but a challenge ;)

> 2. Why is this not exactly (or even a superset of) the \addAt feature I 
> requested?
it propably is ... but in your feature request, you exposed a command
that modifies music given as an argument - without the knowledge of a
context. The technique I showed is engraver-based, so it is
context-based. That leads to two different input-schemes:

1. I want to change the music \A at measure X and moment Y
2. I want to change the output in context A at measure X and moment Y

Using the first input-scheme, one has to know the run of the music to
know the current time-signature and if this music is stored in variables
and is used more than once, the modification will show up on all places
this var is used. That might or might not be expected behaviour.

I started with the second input-scheme, because I wanted to modify the
display of the music (slurs, breaks and such) based on my first printout
for correction. But this approach makes it difficult to add (for
example) notes to the score. (It should be possible, but one has to deal
with a lot of things, lilypond already does ... reimplement the wheel(?) )
Addressing the right context can be tricky, if there are multiple voices
involved.
My intention with this engraver is, to modify the layout without
tweaking the actual music source.

To try a conclusion: Your first post on this request called for
layout-overrides outside the music definition:

> global = \repeat unfold 100 s1
> music = \addAt (4 3/8) \global \once \override RehearsalMark.extra-offset 
> #’(-1 . 0)

This could be done with the edition-engraver I proposed:

\editionMod full 4 3/8 my.global.id.Score.A \once \override
RehearsalMark.extra-offset #’(-1 . 0)

if the Score context \consists \editionEngraver my.global.id

I always look at this in my lalily-world. So I would need some
comments/input how it should work without my great ;) template machine
... well, I will extract that too - when time has come - and then it
will appear restructured in openlilylibs snippets.

Best, Jan-Peter


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


Re: multi-column markup function/macro?

2014-01-17 Thread Jan-Peter Voigt
Hi Alex, hi list,

I changed a little bit of the code.

*ATTENTION*
If you compile the example file and use the xelatex-command, lilypond
will *create* and *delete* several files. One of them is called
"xelatex-.sh" and is executed with

(system "/bin/bash xelatex-.sh")

This is only for development purposes and if you don't trust it, don't
compile it!

If you compile it, you do it on your own risk!
*ATTENTION*

I use this method to unset several environment variables. Due to the
calling of /bin/bash for starting the compilation process, this is
dependent on the existance of BASH. On linux, bsd and mac this should
always be the case - I don't know, what happens on windows here.

I know, this is a very hackish solution ...
but I am interested in comments anyway.

Cheers, Jan-Peter


Am 17.01.2014 07:50, schrieb Jan-Peter Voigt:
> Another thing I have to look at is: I use "system" to call the xelatex
> process. It might be better to use execp or exece.
> I'll investigate.

\version "2.18.0"

#(use-modules
 (ice-9 popen)
 (ice-9 rdelim)
 (ice-9 regex)
 (scm framework-eps)
)

%%%
% ... utilities ...

% this predicate is not public?
#(define (markup-function? x)
  (and (markup-command-signature x)
   (not (object-property x 'markup-list-command

% calculate available page-height
#(define-public (content-height layout props)
  (let ((mm (ly:output-def-lookup layout 'mm))
(height (ly:output-def-lookup layout 'paper-height))
(perc (chain-assoc-get 'percent props 100))
(tm (ly:output-def-lookup layout 'top-margin))
(bm (ly:output-def-lookup layout 'bottom-margin))
(hom (ly:output-def-lookup layout 'oddHeaderMarkup))
(hem (ly:output-def-lookup layout 'evenHeaderMarkup))
(bom (ly:output-def-lookup layout 'oddFooterMarkup))
(bem (ly:output-def-lookup layout 'evenFooterMarkup)))
(define (mupheight mup)(if (markup? mup) (let ((y-ext (ly:stencil-extent (interpret-markup layout props mup) Y)))
   (- (cdr y-ext)(car y-ext))) 0))
(/ (* (- height (+ tm bm (max (mupheight hom)(mupheight hem))
  (max (mupheight hom)(mupheight hem (/ perc 100)) mm)
))

% join string on arbitrary objects
#(define-public (glue-list lst glue)
  "create string from list containing arbitrary objects"
  (string-join (map (lambda (s) (format "~A" s)) lst) glue 'infix))

% read text from multiline comment %{ %}
#(define-public (read-comment port linenr)
   (let ((rstart (make-regexp "^[^%]*%\\{(.*)$"))
 (rend (make-regexp "^(.*)%}.*$")))
 (define (collect lc status . lines)
   (let ((line (read-line port 'concat)))
 (if (string? line)
 (cond
  ((< lc linenr)
   (apply collect (+ lc 1) 0 lines))
  ((= status 0)
   (let ((match (regexp-exec rstart line)))
 (if (regexp-match? match)
 (let ((i (match:start match 1)))
   (apply collect (+ lc 1) 1 (append lines (list (substring line i
   )
 (apply collect (+ lc 1) 0 lines)
 )))
  ((= status 1)
   (let ((match (regexp-exec rend line)))
 (if (regexp-match? match)
 (let ((i (match:start match 1)))
   (apply collect (+ lc 1) 2 (append lines (list (match:substring match 1
   )
 (apply collect (+ lc 1) 1 (append lines (list line)))
 )))
  (else (apply string-append lines))
  )
 (apply string-append lines))
 ))
 (collect 1 0)
 ))

% scheme function to read comment: \readComment
readComment =
#(define-scheme-function (parser location)()
   (let* ((fll (ly:input-file-line-char-column location))
  (file (car fll))
  (linenr (cadr fll))
  (port (open-file file "r")))
 (read-comment port linenr)
 ))

%%%
% clean environment from lilypond entries

ENV_PATH_SEPARATOR = ":"
%FILTER_ENV = #'("PATH" "LD_LIBRARY_PATH" "INSTALLER_PREFIX" "FONTCONFIG_FILE" "FONTCONFIG_PATH" "PANGO_RC_FILE" "PANGO_PREFIX" "PANGO_MODULE" "GUILE_LOAD_PATH" "GS_LIB")
FILTER_ENV = #'("PATH" "LD_LIBRARY_PATH")

#(define-public (filter-path-string str re)
   (string-join
(filter-path-list (string-split str (string-ref ENV_PATH_SEPARATOR 0)) re)
ENV_PATH_SEPARATOR 'infix))
#(define-public (filter-p

running latex with system or execle [was: multi-column markup function/macro?]

2014-01-20 Thread Jan-Peter Voigt
Hi list,

I use xelatex (with fontspec to synchronize fonts with lilypond-pango)
to create text-pages in my lilypond files. This is working quite well
(for my needs), but with the update to 2.18, the styles of the century
schoolbook font are lost. If I (don't remove and) compile the created
.tex-file on the shell, everything is fine.
I committed this piece to openlilylib snippets:

https://github.com/openlilylib/snippets/tree/master/specific-solutions/xelatex-markup-list

Perhaps someone knows a way, to create a "clean" environment for latex
from lilypond-scheme?

*DISCLAIMER {
I would *not* propose such a command for inclusion in standard lilypond,
because it calls external programs via "unsafe" system calls.
But the question to include latex in lilypond was raised more than once
on the user list, so IMO it should be an available public snippet.
} DISPLAIMER*


Hi Alex,

Am 20.01.2014 18:02, schrieb Alex Loomis:
> I'm still getting a lot of warnings, but it works beautifully!

I looked in your log-file. Yes, there a lot more warnings, than I get.
In line 87/88 (xelatex-markup-list.ly) I define a list of environment
variables to clean. All path entries, including 'lilypond' are removed.
As you can see there, only PATH and LD_LIBRARY_PATH are "active". You
can /try/ to add (for example) FONTCONFIG_FILE and _PATH to reduce the
number of warnings.

> The word silence is in roman, but commenting out the line
> 
> \override-lines #'(font-name . "Century Schoolbook L")
> 
> makes it italic. I assume this is because you need to specify an italic
> typeface?

I noticed this after upgrading to 2.18 - see question above.

Best, Jan-Peter



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


running latex with system or execle

2014-01-22 Thread Jan-Peter Voigt

Hi list,

I use xelatex (with fontspec to synchronize fonts with lilypond-pango)
to create text-pages in my lilypond files. This is working quite well
(for my needs), but with the update to 2.18, the styles of the century
schoolbook font are lost. If I (don't remove and) compile the created
.tex-file on the shell, everything is fine.
I committed this piece to openlilylib snippets:

https://github.com/openlilylib/snippets/tree/master/specific-solutions/xelatex-markup-list

Perhaps someone knows a way, to create a "clean" environment to run
latex from lilypond-scheme?

Cheers, Jan-Peter

*DISCLAIMER* {
I would *not* propose such a command for inclusion in standard lilypond,
because it calls external programs via "unsafe" system calls.
But the question to include latex in lilypond was raised more than once
on the user list, so IMO it should be an available public snippet.
} *DISPLAIMER*




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


Re: GSoC 2014

2014-02-20 Thread Jan-Peter Voigt
Hi Janek, David, Urs,

I agree, that the shape-project in fact is a project *and* IMO it is a
very important one.
But if I understand Davids concerns correctly, I agree, that it will be
difficult to define boundaries for this project. You showed a lot of
shapes, which are not "publication ready". And there are some rules how
to determine, if it is a good shape - thank you for your research!
But still there is an artistic freedom - and opinions about the "right"
shape might change - so when will it be finished? When is it "fixed"?
Probably "the journey is its own reward"? Please don't take this too
seriously! ;) Your hard work on this topic is very important and I hope
it will be rewarded the one or the other way!
I just think that the guile v2 project is better suited for GSoC.
Davids proposal for integration of guile v2 is also a proposal of a very
important project, because the day, lilypond needs to keep a legacy
guile lib against newer versions installed versions by default is not
that far away. And this project has a well-defined border: Make lilypond
compile against guile v2 and integrate it in GUB. And guile is the
"standard scripting library" on GNU systems, so it might be easier, to
communicate it to FSF and GSoC(?).
And this would also be a giant leap for musicXML integration (and so
on). If this project is successful, we get this for free ;)

Best, Jan-Peter




Am 20.02.2014 00:34, schrieb Janek Warchoł:
>> What does "fixing tie formatting" mean?  That no tie needs tweaking any
>> > more?
> That all of the example ties from my research (a couple hundred ties,
> they cover almost all real-life tie occurrences) are formatted
> correctly by default.  Assuming my examples are representative (and
> believe me, i know what i'm doing) this should mean that 99% (maybe up
> to 99.9%) of all ties in Lilypond-made scores will be good by default.
>  (Currently only about 64% ties are correct, as real-life statistics
> has shown 
> http://lilypondblog.org/2014/01/engraving-statistics-slurs-and-ties/).



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


Re: GSoC 2014

2014-02-20 Thread Jan-Peter Voigt
Am 20.02.2014 10:58, schrieb David Kastrup:
> I have already been told by the Mageia maintainer that LilyPond would
> likely stop getting distributed by them if it continues to require
> GUILEv1.  While I'm not sure if and when this threat will come true, we
> _are_ pissing off distribution maintainers by now with this requirement.
huah, it is worse than I thought.

> Not really: the XML libraries are also available for GUILEv1.  But in
> general, large-scale architecture extensions should not be done based on
> GUILEv1.  That does not make sense.
I tried once to get this running but left it, because it was more than
just install and work. I also tried to write a guile extension to start
a java-jvm. No joke, it is running and I can display lilypond code in a
web-browser from an arbitrary music-expression. But of course it is
really unstable - I think it is not a good idea to have two garbage
collectors running the same time. And of course this project is pure
procrastination ;)

> I've stalled
> http://code.google.com/p/lilypond/issues/detail?id=2716> for quite
> a while yet since some parts of it would be better/differently done
> using GUILEv2.
Would it also be easier to make lilypond a library, if it is based on
guile v2?

Best, Jan-Peter




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


Re: how close are we to having an "addAt" or "insertAt" feature?

2014-02-27 Thread Jan-Peter Voigt
Hi Kieren,

Am 27.02.2014 04:44, schrieb Kieren MacMillan:
> Hi Jan-Peter,
> ...
> Are you interested in taking up that challenge?  =)
yes, I am :)
And I will answer more , when I left all infections behind, which my
children brought from school and kindergarten ...

> I would love a dead-simple, drop-in solution which would require minimal 
> adjustments to a score in order for it to accept “edition tweaks”. I tried to 
> adapt your example (see below), but had a few difficulties, and gave up 
> quickly because of the time constraints I was under at the time — I am now 
> much freer, and would love to take this to the goal line.
Perhaps my explanations get us a step forward to the dead-simple-drop-in.

>   BEGIN
> 
> \version "2.18.0"
> \include "edition-engraver.ly"
> 
> \addEdition test
> % color the notehead red on the second quarter in the second measure
> \editionMod test 2 1/4 my.test.Staff.A \once \override NoteHead #'color = #red
> % destroy the slur starting on the second quarter in the first measure
> \editionMod test 1 2/4 my.test.Staff.A \shape #'((0 . 0)(0 . 1)(0 . -1)(0 . 
> 0)) Slur
> 
> \layout {
>   \context {
> \Score
> \consists \editionEngraver my.test
>   }
> }
> 
> music = \relative c'' { c4 bes a( g) f e d c }
> 
> \new Staff \with { \consists \editionEngraver my.test }
>   \new Voice \with { \consists \editionEngraver ##f } \music
> 
>   END
> 
> It looks dead simple… but (a) I don’t understand what the “my” is, nor where 
> “Staff.A” comes from, nor why you need to \consist a ##f engraver in the 
> Voice, etc.
a) The "my" is the first part of an arbitrary identification part of the
engraver. In fact "\editionEngraver" is a scheme function, which returns
an engraver with the given id-path. So it might be
\consists \editionEngraver kierens.great.musical

b) The "Staff.A" is added to the path by the engraver on initialization.
The engraver adds the context-name to the id-path, which is in this case
"Staff", and then adds a counter, which is in fact a letter, so that we
can use dot-notation: "kierens.great.musical.Staff.1" will not parse,
but "kierens.great.musical.Staff.A" will.

c) With "\editionEngraver ##f" an engraver is created, which searches
the parental contexts for an id and inherits the id. It is just adding
its own context name and counter, in this case "Voice.A". So for the
above example it is equivalent to \new Voice \with { \consists
\editionEngraver my.test }
I found it easier to declare ids per staff:
A global
\layout { \context { \Voice \consists \editionEngraver ##f } }
adds edition-engravers, inheriting the parental id, to each voice
automatically.


> Start with a simpler (pseudo-)example:
> 
>   BEGIN
> 
> \version "2.18.0"
> \include "edition-engraver.ly"
> 
> \addEdition editionA
> % color the notehead red on the second quarter in the second measure
> \editionMod editionA 2 1/4 Staff.Singer \once \override NoteHead #'color = 
> #red
> % destroy the slur starting on the second quarter in the first measure
> \editionMod editionA 1 2/4 Staff.Singer \shape #'((0 . 0)(0 . 1)(0 . -1)(0 . 
> 0)) Slur
> 
> \layout {
>   \context {
> \Score
> \consists \editionEngraver editionA
>   }
> }
> 
> music = \relative c'' { c4 bes a( g) f e d c }
> 
> \new Staff = “Singer" \with { \consists \editionEngraver editionA } \music
> 
>   END
> 
> Why is something like that not possible?
> n.b. I'm invoking Occam’s Razor here: I’ll happily accept more complexity 
> only if it is required for greater power.  ;)

Hm, what might be possible? First: It is good, that you brought up an
"editionA" tag. Second: I try to explain some background:
There are multiple distinct attributes to address a location, where,
when and if an override shall be applied:

1) edition-engraver id, which is in fact a path to the context
2) measure and moment in music
3) edition-flight-name - or whatever to call that ;)

1) The engraver-id is my.test in the given example, it might be
"kieren.musical.about.something" or anthing else.
And you can use kieren.musical.about.something.strings.violin.III, to
discriminite separate groups.
2) self-explanatory
3) You used editionA in your example - and that is actually what I
thought of:
One wants to have an editionA for the full-score and an editionB for the
soloist parts and so on. A proposed name might be "flight-name" for
that. The editionMod command takes a flight name as first argument and
the addEdition command doesn't need to be called before that. So you
might do in the music definition part (pseudo-code):
%%%
\editionMod fullscore 2 1/4 path.to.Staff.A \shape #'() Slur
\editionMod part 2 1/4 path.to.Staff.A \shape #'() Slur
%%%
And then creating part (pseudo-code):
%%%
\include "edition-engraver.ly"
\include "the-music.ly"
\include "the-editions.ly"

\addEdition fullscore
\include "fullscore-template.ly"
%%%

There are multiple entities to acknowledge: The music, the
engraving-process and the edition modifications. It is a lot easie

Re: how close are we to having an "addAt" or "insertAt" feature?

2014-02-28 Thread Jan-Peter Voigt
On 28.02.2014 09:43, David Kastrup wrote:
>> Although my 3½ year old daughter has had several bouts of
>> > “day-care-itis” — and my wife picked it up several times — I’ve
>> > fortunately avoided all sickness this season.
> Well, as long as it isn't the six-legged variant of day-care-itis...
;)



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


Re: how close are we to having an "addAt" or "insertAt" feature?

2014-02-28 Thread Jan-Peter Voigt
Hi Kieren,

On 28.02.2014 02:53, Kieren MacMillan wrote:
> Although my 3½ year old daughter has had several bouts of
> “day-care-itis” — and my wife picked it up several times — I’ve
> fortunately avoided all sickness this season. 
Best wishes, that it stays that way and that your wife is not suffering
too much!
On my part it got worse. I was going to visit friends in Hamburg this
weekend ... now my family had to leave me here alone ...
>> a) The "my" is the first part of an arbitrary identification part of the
>> engraver. In fact "\editionEngraver" is a scheme function, which returns
>> an engraver with the given id-path. So it might be
>> \consists \editionEngraver kierens.great.musical
> So the ‘test’ in '\addEdition test’ is not related to the ‘test’ in ‘my.test’?
Yes, and you got me on that detail! Its a kind of lazyness, to call it
all "test" or "my.test" and has to irritate anyone not knowing in
advance, what I am doing here.

I am going to produce examples with more meaningful names.

Best, Jan-Peter


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


Re: how close are we to having an "addAt" or "insertAt" feature?

2014-02-28 Thread Jan-Peter Voigt

Hi Kieren,

Am 28.02.14 17:01, schrieb Kieren MacMillan:

Hi again,

Any explanation for why

 \editionMod edition-engraver-name 2 1/4 edition-name.Staff.A \break

I thought, it should work also in the Staff context.
But it should at least work, if you address the Score context.

\editionMod edition-engraver-name 2 1/4 edition-name.Score.A \break


HTH

Jan-Peter


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


Re: how close are we to having an "addAt" or "insertAt" feature?

2014-02-28 Thread Jan-Peter Voigt

Hi Kieren,

sorry, I missed to mention the zero-based counting. We will propably 
find more of those black spots ... you are the first one, with whom I 
talk about using it ;)

Well, fever is decending and I will have a cup of hot tea and some aspirin.
In my first versions, I used one-based counting for the fraction input, 
so 1/4 was the first moment in the measure. But I didn't like the 
inconsistency between input as a fraction, which is in fact just a 
shortcut for #(ly:make-moment ...). BTW, you can always use make-moment 
to address for example the second note of a triplet-group.


Now, if you want to insert a mid-measure break, you can add the \bar "" 
to the editionMod:

\editionMod flightname 2 1/4 engravername.Score.A { \bar "" \break }

If you want add the \bar "" /automatically/ in a polymetric piece, it 
gets a little bit complicated.
As a first step for such cases, you can add it manually to the staff 
contexts:


\editionMod edition-engraver-name 2 1/4 edition-name.Staff.A \bar ""
\editionMod edition-engraver-name 2 1/4 edition-name.Score.A \break

I have one polymetric piece, where I used it. It worked in the end, but 
it gets quite tricky, to get the right measure- and moment-counting for 
the Staff contexts and the global Score context.
To add the empty barline, if there isn't one already, would be very 
nice.  We should try to make it possible.


One note on the flightname/engravername: You activate multiple 
flightnames. One of them might be "annotation",

so you can add annotations and only activate them for a corrections

\editionMod annotation 2 0/4 edition-name.Voice.A -\markup { \with-color 
#red "what's that?" }



This will only show up, if you did
\addEdition annotation
before engravement.


Best, Jan-Peter


Am 01.03.14 03:54, schrieb Kieren MacMillan:

Hi Jan-Peter,

Answered my own question:


this doesn’t work for me:
\editionMod edition-engraver-name 2 1/4 edition-name.Score.A \break

It needs rather to be

 \editionMod edition-engraver-name 2 0/4 edition-name.Score.A \break

[!!]

Onwards and upwards.
Kieren.


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


Re: how close are we to having an "addAt" or "insertAt" feature?

2014-03-01 Thread Jan-Peter Voigt
Hi Kieren,

I added a function editionMMod, which takes a list of positions.
Function name and argument order should be chenged ...
For now, the position-list replaces measure and moment.
So

\editionMod FTE-vocalbook 5 0/4 FTE-vocalbook-A.Score.A \break

should be equal to

\editionMMod FTE-vocalbook #'((5 0/4)) FTE-vocalbook-A.Score.A \break

More on that on tuesday.

Best, Jan-Peter


On 01.03.2014 13:36, Kieren MacMillan wrote:
> The other thing that would be very helpful is a listing function, so that 
>
> \editionMod FTE-vocalbook 5 0/4 FTE-vocalbook-A.Score.A \break
> \editionMod FTE-vocalbook 9 0/4 FTE-vocalbook-A.Score.A \break
> \editionMod FTE-vocalbook 13 0/4 FTE-vocalbook-A.Score.A \break
> \editionMod FTE-vocalbook 16 0/4 FTE-vocalbook-A.Score.A \break
> \editionMod FTE-vocalbook 22 0/4 FTE-vocalbook-A.Score.A \break
> \editionMod FTE-vocalbook 25 0/4 FTE-vocalbook-A.Score.A \break
> \editionMod FTE-vocalbook 28 0/4 FTE-vocalbook-A.Score.A \pageBreak
> \editionMod FTE-vocalbook 58 0/4 FTE-vocalbook-A.Score.A \pageBreak
> \editionMod FTE-vocalbook 94 0/4 FTE-vocalbook-A.Score.A \pageBreak
> \editionMod FTE-vocalbook 110 0/4 FTE-vocalbook-A.Score.A \pageBreak
> …
>
> could rather be something like
>
> \editionMod FTE-vocalbook FTE-vocalbook-A.Score.A \break ‘((5 0/4) (9 
> 0/4) (13 0/4) (16 0/4) (22 0/4) (25 0/4))
> \editionMod FTE-vocalbook FTE-vocalbook-A.Score.A \pageBreak ‘((28 0/4) 
> (58 0/4) (94 0/4) (110 0/4))
>
> There are many, many duplicate/multiple tweaks that I would love to apply in 
> such a manner.

\version "2.18.0"
\include "util.ily"

#(use-modules (oop goops))

% custom string representation of a moment
#(define-public (moment->string mom)
   (if (ly:moment? mom)
   (let ((num (ly:moment-main-numerator mom))
 (den (ly:moment-main-denominator mom))
 (gnum (ly:moment-grace-numerator mom))
 (gden (ly:moment-grace-denominator mom)))
 (format "(~A/~A~A)" num den
   (cond
((> gnum 0)(format "+~A/~A" gnum gden))
((< gnum 0)(format "~A/~A" gnum gden))
(else "")
))
 )
   "(?:?)"
   ))

%
% class to store for example \set stanza = "1."

#(define-class  ()
   (once #:init-value #t #:accessor is-once #:setter set-once! #:init-keyword 
#:once)
   (symbol #:accessor get-symbol #:setter set-symbol! #:init-keyword #:symbol)
   (value #:accessor get-value #:setter set-value! #:init-keyword #:value)
   (previous #:accessor get-previous #:setter set-previous! #:init-value #f)
   (context #:accessor get-context #:setter set-context! #:init-keyword 
#:context)
   )
% apply set to context
#(define-method (do-propset context (prop ))
   (if (get-context prop)
   (let ((parctx (ly:context-find context (get-context prop
 (if (ly:context? parctx) (set! context parctx
   (set-previous! prop (ly:context-property context (get-symbol prop)))
   (ly:context-set-property! context (get-symbol prop) (get-value prop))
   )
%(export do-propset)
% apply unset to context
#(define-method (reset-prop context (prop ))
   (if (get-context prop)
   (let ((parctx (ly:context-find context (get-context prop
 (if (ly:context? parctx) (set! context parctx
   (ly:context-set-property! context (get-symbol prop) (get-previous prop))
   )
%(export reset-prop)

% predicate
#(define-public (propset? p)(is-a? p ))
% serialize to string
#(define-method (propset->string (ps ))
   (format "~A\\set ~A = ~A" (if (is-once ps) "once " "") (string-append (if 
(get-context ps) (format "~A." (get-context ps)) "") (format "~A" (get-symbol 
ps))) (get-value ps)))
%(export propset->string)
% implement display
#(define-method (display (o ) port) (display (propset->string o) port))

%

% store applyContext
#(define-class  ()
   (proc #:accessor procedure #:setter set-procedure! #:init-keyword #:proc)
   )
% apply stored function to context
#(define-method (do-apply ctx (a ))
   ((procedure a) ctx))
%(export do-apply)
% predicate
#(define-public (apply-context? a)(is-a? a ))

% store overrides
#(define-class  ()
   (once #:init-value #t #:accessor is-once #:setter set-once! #:init-keyword 
#:once)
   (revert #:init-value #f #:accessor is-revert #:setter set-revert! 
#:init-keyword #:revert)
   (grob #:accessor get-grob #:setter set-grob! #:init-keyword #:grob)
   (prop #:accessor get-prop #:setter set-prop! #:init-keyword #:prop)
   (value #:accessor get-value #:setter set-value! #:init-keyword #:value)
   (context #:accessor get-context #:setter set-context! #:init-keyword 
#:context)
   )
% serialize to string
#(define-method (oop->string (o ))
   (let* ((ctxn (get-context o))
  (ctxp (if ctxn (format "~A." ctxn) "")))
 (if (is-revert o)
 (string-append "\\revert " ctxp (format "~A " (get-grob o)) (format 
"#'~A" (get-prop o)))
 (string-append (if (is-once o) "\\once " "") "\\overri

edition-engraver and templates

2014-03-28 Thread Jan-Peter Voigt
Hello list,

today I want to announce the edition-graver and lalily-templates in
openLilyLib:
https://github.com/openlilylib/snippets/tree/master/templates/lalily
https://github.com/openlilylib/snippets/tree/master/editorial-tools/edition-engraver

I invite you to test it. The examples compile with lily 2.18 (stable)
and 2.19.3 (devel).
As with all snippets, you have to add the path to the openSnippetLib to
the include paths
either via CLI-option -Ipath/to/snippets or for example in frescobaldi
in the preferences.
Then you can type

\include "templates/lalily/definitions.ily"

or

\include "editorial-tools/edition-engraver/definitions.ily"


Then you can start using it.

This is a work in progress. The list of predefined templates is far from
complete, but it might be usefull.

If you have comments or questions, don't hesitate to contact me.

Cheers, Jan-Peter


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


detecting current voice number (voiceOne/voiceTwo/...)

2014-04-02 Thread Jan-Peter Voigt
Hello list,

I'd like to detect the current voice-number for the voice-context:
for example it might be something like:
\oneVoice -> 0
\voiceOne -> 1
\voiceTwo -> 2
\voiceThree -> 3

If I look at the horizontal-shift for the NoteColumn, I get
\oneVoice -> #f
\voiceOne -> 0
\voiceTwo -> 0
\voiceThree -> 1

So how do I discriminate voiceOne and voiceTwo?
I might look at Stem-direction or the like, but this might be overridden.
Is there a property with the group number?

Jan-Peter

--snip--
\applyContext #(lambda (context) (display (chain-assoc-get
'horizontal-shift (ly:context-property context 'NoteColumn
--snip--

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


Re: Serious feedback and improvement headroom

2014-04-04 Thread Jan-Peter Voigt
Am 04.04.2014 14:24, schrieb David Kastrup:
> Urs Liska  writes:
> 
>> The most interesting aspect of the meeting was that Henle's (only)
>> in-house engraver was present too, and this may become a fruitful
>> contact. He is using Amadeus, a Linux (!) program he bought for 20.000
>> Euro in 1988
> Well, in 1988 there was no Euro.  I presume that you have just converted
> by some factor.  But in 1988 there also was no Linux.  Obviously,
> conversion by a factor would not help with that.
maybe he bought a unix-application, which runs on linux?
anyway, thats not the point ;)

>> As a response to my argument that I prefer explicit pitches (a fis is
>> a fis, regardless of needing a sharp or not, while in Amadeus a pitch
>> is only defining a notehead position) he sais: "I don't understand why
>> I should always enter the accidentals explicitly when they are already
>> defined by the key. When I'm seeing the current key in the score
>> display, I do know that in es major the a is actually an as, isn't it?
> 
> Oh, he's perfectly right about that.  If you are writing a _score_, it
> is reasonable to write down what you see if your goal is to reflect a
> manuscript.  With LilyPond, the focus is on describing music rather than
> programming output, however.  There are advantages to that since I am
> not fixed in the key signature.  I can easily decide at a late stage of
> publishing whether I'll be writing Bach's "Dorische" in the rather
> unmotivated dorian key or whether I just punt and print it in d minor.
> 
> I can use the same source for a number of different styles including the
> Urtext.
+1
I'd never want to give up the flexibility.

>> I don't suggest any significant changes in our input syntax. But I
>> want to point out that editing efficiency on that level _is_ an issue
>> we should keep taking into account when it comes to professional
>> work.
> Current LilyPond input tools, editors, and workflows suck.  That is not
> LilyPond's "responsibility" as a command line tool, but of course it is
> something affecting its uptake nevertheless.
Frescobaldi doesn't suck! It is a very handy tool to enter lilypond code
with its code assistance. But for anyone used to another application, it
is a foreign tool-chain. I know so many people, who fear the switch from
MS Office to OpenOffice, because they are so different.


>> So maybe we really have a conceptual issue with the efficiency of
>> LilyPond's runtime work.
> 
> In the current environment?  I don't think all that much.  The important
> thing remains the creative process, and that does not (or should not)
> involve running LilyPond.
> 
> We _are_ too slow in our backend.  No question about that.  Parsing a
> file is much faster than typesetting it.  And the parsing still could be
> sped up considerably regarding the Scheme/LilyPond synchronization.
> 
>> As I can't imagine that we can speed up LilyPond's processing time by
>> 95% I really think we should find ways for partial recompilation. This
>> is reportedly also the approach the new Steinberg application
>> takes. For example when entering music I could do with only updating
>> the currently interesting section (maybe a system would be a good unit
>> for that).
> 
> LilyPond is a command line application.  Partial recompilation does not
> really map sensibly to it.

>> Maybe it would be possible to create compilation modes that have a
>> significantly sloppier approach to breaking. There are many stages in
>> the development of a score where I don't care at all about the layout
>> of the complete score. I recall that in Finale you could (probably:
>> can) switch between score and roll mode (however this has been
>> called).
> 
> You can do that in LilyPond as well.  The resulting output is not
> necessarily all that handy for typical previewers.
> 
>> Using strategies with skipTypesetting can help a lot in saving
>> compilation time. But it would be an extremely useful enhancement if
>> we could get some kind of partial recompilation _within_ the context
>> of an existing score.
> 
> That kind of stuff needs to get integrated into editing tools and modes
> since only editing tools and modes have the effortless information about
> what is currently on-screen and/or edited.
> 
>> [I just got another email indicating that Amadeus will by default
>> recalculate the current page only, and this works in near instant
>> time. I think with this we can get to an area where calculating
>> efficiency can make such a difference.]
> 
> Still needs integration with the editing tool.
> 
>> What I would vote for very much is an option to recalculate the
>> current system only, but with outputting the complete score anyway
>> (however it may be determined what "current" is). This should work in
>> many cases when a modification doesn't change line breaking. And it
>> would dramatically increase the editing experience.
> 
> There is little point in investing a lot of effort here when the current
> editing tools do not e

Re: Partial compilation

2014-04-04 Thread Jan-Peter Voigt
On 04.04.2014 16:32, Urs Liska wrote:
> But lilypond probably could assist a frontend with a map from musical
>> flow to paper-flow. If the GUI knows that on page 3 are measures 27-42
>> and the front end tracks an action, where I modified one slur-shape or
>> one pitch, the front-end could trigger a compilation of measures 27-42
>> and not the whole score.
>> Its just an idea ...
>
> Maybe that map wouldn't even be possible. I _assume_ that an editor
> might get that information by itself through point-and-click. But
> having the information directly would of course ease things.
With delayed expressions - they are used for table of contents - it
should be possible to get page infos related to grobs and there musical
positions. ... and now I have to take care not to start to play
schemedoku again ;)

> What seems very useful to me would be something like this:
>
> - compile a score similarly to using lilypond-book-preamble, i.e. in
> individual files per system.
> - write out something like a LaTeX .aux file with information about
> measures in the systems. Editors can parse this file to know about the
> piece. An editor should then also be able to display these individual
> files like one score (maybe as a continuous page).
> - Enable Lilypond to compile just a given system. This would probably
> work similar to skipTypesetting but with the difference that the
> system is laid out exactly as in the full context. Am I right that -
> once the line breaking has been done - a system is a quite independent
> entity for LilyPond?
>
> That way an editor could provide a continuous view of the score and
> let LilyPond recompile any given system without having to redo
> everything else.
> And it would be sufficiently straightforward to let LilyPond (or the
> editor) protest when the line breaking doesn't work anymore (e.g. the
> recompiled line gets longer and would need different line breaks).
>
> For a "music entry mode" this could even be extended by a compilation
> mode that doesn't care at all about page breaking. Let the lines be
> ragged right and simply add measures until the line is full. This
> should reduce a noticeable part of the compilation time.
Or lilypond shall just encode (ragged) all measures visible in a view to
scroll only horizontal the whole piece.

More on this on monday ;)

Have a nice weekend!


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


  1   2   >