Re: edition-engraver mod on first note

2020-11-07 Thread Stefano Troncaro
Hi Damian, can you post an example? If I remember correctly (I may be
misremembering) there is an issue in scores starting with \partial

But for example I use the following on a score:

LVm = \musicPath PNO.left.Voice.main
> \editionMod ed 1 0 \LVm {
>   \once \override DynamicText.X-extent = #empty-interval
>   <>_#(make-dynamic-text "col pedale")
> }


And it works properly.

Hope that helps,
Stéfano

El vie., 6 nov. 2020 a las 13:41, damianlegassick ()
escribió:

> Hi
>
> I can't persuade edition-engraver to add an \editionMod starting on the
> downbeat of the first bar. I can't even do it with the example.ly from
> the repo (is that why there's an R1 at the top?).
>
> any clues for a workaround or am I being dumb?
>
> Damian
>


Re: edition-engraver mod on first note

2020-11-07 Thread Stefano Troncaro
I rendered your MWE and Lilypond created the red note... then I checked the
repo and it seems I don't have the newest version, I'm using an old commit
from the refactor-override branch. I will check later with the latest
master and let you know how it goes.

El sáb., 7 nov. 2020 a las 19:47, damianlegassick ()
escribió:

> Hi Stefano
>
> this is extracted from the example-1.ly from the repo
>
> \version "2.20.0"
> \include "oll-core/package.ily"
> \loadPackage edition-engraver
> \addEdition test
> \editionMod test 1 0/4 along.Voice.A \once \override NoteHead.color = #red
> \editionMod test 1 1/4 along.Voice.A \once \override NoteHead.color =
> #green
> \consistToContexts #edition-engraver Staff.Voice
> \new Staff \with { \editionID along } { c'4 c' c' c' }
>
> no red note...
>
> Damian
>
> On 7 November 2020 at 19:55, Stefano Troncaro 
> wrote:
>
> Hi Damian, can you post an example? If I remember correctly (I may be
> misremembering) there is an issue in scores starting with \partial
>
> But for example I use the following on a score:
>
> LVm = \musicPath PNO.left.Voice.main
>> \editionMod ed 1 0 \LVm {
>>   \once \override DynamicText.X-extent = #empty-interval
>>   <>_#(make-dynamic-text "col pedale")
>> }
>
>
> And it works properly.
>
> Hope that helps,
> Stéfano
>
> El vie., 6 nov. 2020 a las 13:41, damianlegassick (<
> damianlegass...@mac.com>) escribió:
>
>> Hi
>>
>> I can't persuade edition-engraver to add an \editionMod starting on the
>> downbeat of the first bar. I can't even do it with the example.ly from
>> the repo (is that why there's an R1 at the top?).
>>
>> any clues for a workaround or am I being dumb?
>>
>> Damian
>>
>


arranger.ly and lilypond 2.21+: error with the \note markup command

2021-01-15 Thread Stefano Troncaro
Hi everyone,

I started learning to use the spectacular arranger.ly library
 that was mentioned in the list a
while ago.

While most of it works great, I found that internally it sometimes uses the
\note markup command, that changed between versions: in 2.20 it requires an
argument of type string, while from 2.21 onwards it requires an argument of
type duration. This causes an error and makes it so that files that use
arranger.ly do not compile on Lilypond 2.21 onwards.

I'm sure it'd be easy to patch. Is there an easy way to transform strings
into durations?


Re: arranger.ly and lilypond 2.21+: error with the \note markup command

2021-01-16 Thread Stefano Troncaro
Harm, Aaron, thank you both for your answers. Both are great solutions!

El sáb, 16 ene 2021 a las 0:27, Aaron Hill ()
escribió:

> On 2021-01-15 4:10 pm, Thomas Morley wrote:
> > Am Fr., 15. Jan. 2021 um 23:26 Uhr schrieb Stefano Troncaro
> > :
> >>
> >> Hi everyone,
> >>
> >> I started learning to use the spectacular arranger.ly library that was
> >> mentioned in the list a while ago.
> >>
> >> While most of it works great, I found that internally it sometimes
> >> uses the \note markup command, that changed between versions: in 2.20
> >> it requires an argument of type string, while from 2.21 onwards it
> >> requires an argument of type duration. This causes an error and makes
> >> it so that files that use arranger.ly do not compile on Lilypond 2.21
> >> onwards.
> >>
> >> I'm sure it'd be easy to patch. Is there an easy way to transform
> >> strings into durations?
> >
> > Iiuc, how about:
> >
> > %% from define-markup-commands
> > #(use-modules (ice-9 regex))
> >
> > #(define-public log2
> >   (let ((divisor (log 2)))
> > (lambda (z) (inexact->exact (/ (log z) divisor)
> >
> > #(define (parse-simple-duration duration-string)
> >   "Parse the `duration-string', e.g. ''4..'' or ''breve.'',
> > and return a (log dots) list."
> >   (let ((match (regexp-exec (make-regexp
> > "(breve|longa|maxima|[0-9]+)(\\.*)")
> > duration-string)))
> > (if (and match (string=? duration-string (match:substring match
> > 0)))
> > (let ((len (match:substring match 1))
> >   (dots (match:substring match 2)))
> >   (list (cond ((string=? len "breve") -1)
> >   ((string=? len "longa") -2)
> >   ((string=? len "maxima") -3)
> >   (else (log2 (string->number len
> > (if dots (string-length dots) 0)))
> > (ly:error (_ "not a valid duration string: ~a")
> > duration-string
> >
> > %% and then:
> >
> > #(define (string->duration strg)
> >   (apply ly:make-duration (parse-simple-duration strg)))
> >
> > %% test
> > #(display-scheme-music (string->duration "16.."))
> >
> > Cheers,
> >   Harm
>
> Here's a back-compat patch that should allow \note to accept strings.
> Could be useful until arranger.ly is updated to use ly:durations in
> places where it relied on strings before.
>
> 
> \version "2.22.0"
>
> #(begin
>(define (duration-or-string? arg)
> (or (ly:duration? arg) (string? arg)))
>(define-markup-command
> (note layout props duration dir)
> (duration-or-string? number?)
> #:category music
> #:properties (note-by-number-markup)
> (if (string? duration)
>  (set! duration
>   (ly:parse-string-expression (ly:parser-clone) duration)))
> (note-by-number-markup layout props
>(ly:duration-log duration)
>(ly:duration-dot-count duration)
>dir)))
>
> \markup {
>\note { 8. } #DOWN \note "8." #DOWN
>\note { \longa*2/3 } #UP \note "\longa*2/3" #UP
> }
> 
>
>
> -- Aaron Hill
>


Re: Sending around contexts

2021-10-29 Thread Stefano Troncaro
Hi all! I just needed to state that this thread completely blew my mind.
Sorry for the spam, I found this too awesome to watch silently.

El vie, 29 oct 2021 a las 10:25, Kieren MacMillan (<
kieren_macmil...@sympatico.ca>) escribió:

> Hi David,
>
> >> My *big* question is: Can notes be pushed *with timing
> >> synchronization* between context?
> >
> > Without storing events, how would it even be possible without timing
> > synchronisation?  Iteration happens in time order.  Well, apart from
> > grace timing quirks.
>
> 1. That was my intuition, but I’m glad to hear it confirmed.
>
> 2. The grace timing quirk — which has (“coincidentally”?!) been plaguing
> me on my current engraving project — will likely be even more bothersome in
> the type of “context-jumping” scores I’m talking about.
>
> >> Can this kind of mechanism be used to [easily] engrave scores like the
> >> following?
> >
> > There is no "easily" in such scores.  The question is rather whether you
> > encounter problems doing such scores where particular tools can simplify
> > the work of creating the input.  For that one first has to develop an
> > input process and see what problems are "hard" in that context.
>
> I’ll see what I can do about drawing up a reasonably-Minimum Working
> Example to act as an initial straw man.
>
> Thanks,
> Kieren.
> 
>
> Kieren MacMillan, composer (he/him/his)
> ‣ website: www.kierenmacmillan.info
> ‣ email: kie...@kierenmacmillan.info
>
>
>


Re: Acciaccatura distoring spacing

2019-05-20 Thread Stefano Troncaro
Oh I see, troubleshooting in big projects like what you describe can be so
painful.

Hopefully you figure out specifically what in your poly-mark-engraver.ily
is conflicting with overriding the SpacingSpanner. Perhaps if you manage to
isolate the problem and make a short example showing the bizarre results
you described someone in this list will be able to figure out what is
happening and how to fix the poly-mark-engraver.

Anyways, I'm happy you solved it!

El lun., 20 may. 2019 a las 18:01, David Sumbler ()
escribió:

> Hi Stefano,
>
> I have now re-read the Horizontal Spacing section, and I am a bit wiser
> than I was.
>
> When I tried it, the fix you suggested worked perfectly for the snippet
> in my email.  But I had great difficulty when I applied it to my actual
> score: I kept getting numerous warnings:
>
> programming error: Cannot determine neighbors for floating column.
> continuing, cross fingers
>
> Also, depending where I began/ended the strict-grace-spacing, I
> sometimes had really bizarre results with a barline in completely the
> wrong place and actually passing through noteheads!
>
> After about 2 hours trying to isolate the cause, I found that it was
> due to the fact that my default include file itself includes poly-mark-
> engraver-ily.  I disabled this, and then recompiled the whole score
> (all 150 pages of it).  To my great relief I found that there were no
> problems: clearly I have not actually used the poly-mark facility in
> this score.
>
> Thank you very much for your help on this.
>
> David
>
>
> On Mon, 2019-05-20 at 12:45 -0300, Stefano Troncaro wrote:
> > Hi David,
> >
> > Ttake a look a this snippet:
> >
> > \version "2.19.82"
> >
> > \paper { line-width = 65\mm }
> >
> > <<
> >   {
> > \new Staff \time 2/4
> > \newSpacingSection
> > \override Score.SpacingSpanner.strict-grace-spacing = ##t
> > \tuplet 7/4 { g'16 a' b' c'' d'' e'' f'' } g''8 r
> >   }
> >   {
> > \new Staff
> > \tuplet 3/2 4 { g''8 \acciaccatura a'' g'' g'' } g'' r
> >   }
> > >>
> >
> > Does this fix it for you? If it does, I encourage you to read the
> > chapter on horizontal spacing of the Notation Reference, and then
> > also look at the SpacingSpanner properties and interfaces in the
> > Internals Reference.
> >
> > Hope that helps!
> > Stéfano
>
>
>
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Acciaccatura distoring spacing

2019-05-26 Thread Stefano Troncaro
Hi David,

Look at this:

%
\version "2.19.82"
\language "english"
#(set-global-staff-size 16)

strictGraceTrue = {
  \newSpacingSection
  \override Score.SpacingSpanner.strict-grace-spacing = ##t }

strictGraceFalse = {
  \newSpacingSection
  \override Score.SpacingSpanner.strict-grace-spacing = ##f }

\score {
  \new StaffGroup <<
\new Staff { s4*5*2 }
\new Staff \relative { \time 5/4
  r2
  \strictGraceTrue
  \tuplet 3/2 4 {r8 \acciaccatura a'' g-. \acciaccatura a g-.
 \once \hide TupletBracket
 \acciaccatura a g[-. r \acciaccatura a g]-.
 \acciaccatura a g-. \acciaccatura a g-. r} |
  \noBreak \strictGraceFalse
  \tuplet 3/2 4 {\once \hide TupletBracket \acciaccatura a g8-.
 \acciaccatura a g-. \acciaccatura a g-.
 r \acciaccatura a g-. \acciaccatura a g-.}
  \acciaccatura a g-.
  r r2 |
}
\new Staff \relative {
   r2 g''16-. g-. e'( c) g-. g-. e'( c) g-. g-. e'( c) |
   \grace s8 g=''16-. \strictGraceTrue g-. e'( c) r4 g16-. g-. e'( c)
   r8 e,16-. fs-. g-. a-. b-. c-. |
}
  >>
}
%

I'm sorry I don't have time to write a full explanation, or more tests now,
but I think the problem lies with the fact that the bar starts with an
acciacatura in one Voice, but there is a bar check and no acciacatura in
the other Voice. Writing an acciacatura with a spacer rest in the voice
that has no printed grace note solves the issue. To avoid having the grace
(that occupies no time with the strict-grace-spacing set to #t) collide
with the barline, I changed spacing sections.

Hope this helps,
Stéfano

El dom., 26 may. 2019 a las 13:29, David Sumbler ()
escribió:

> Armed with this method of correcting the spacing when acciaccature occur
> in conflicting rhythms, I tried applying it to some other passages which
> had similar but less noticeable spacing problems.
>
> But there is a difficulty, which I mentioned before: if a barline occurs
> within a system, the barline is often printed in completely the wrong
> place, passing through noteheads etc. The error is always in shifting the
> barline to the right by a couple of inches or so.
>
> Yet everything else about the output appears fine: the line end comes in
> the correct place (complete with barline), and the spacing is as required.
>
> I blamed polymark when I reported this problem before. But now I find
> that, although I thought that disabling polymark had solved the problem, in
> other places the wrongly-placed barline occurs even when polymark is not
> included in the files.
>
> The following pared down version of a couple of bars illustrates the
> problem.  It compiles correctly as it stands. But if the commented line is
> removed, then on my system, at least, the barline which should be placed
> after 5 crotchets, actually appears almost at the end of the line, after
> 9.25 crotchets.
>
> %%%
> \version "2.19.82"
> \language "english"
> #(set-global-staff-size 16)
>
> \score {
>   \new StaffGroup <<
> %{ \new Staff s4*5*2 }
> { \new Staff \time 5/4 \relative {
>   r2
>   \newSpacingSection
>   \override Score.SpacingSpanner.strict-grace-spacing = ##t
>   \tuplet 3/2 4 {r8 \acciaccatura a'' g-. \acciaccatura a g-.
>  \once \hide TupletBracket
>  \acciaccatura a g[-. r \acciaccatura a g]-.
>  \acciaccatura a g-. \acciaccatura a g-. r} |
>   \noBreak
>   \tuplet 3/2 4 {\once \hide TupletBracket \acciaccatura a g8-.
>  \acciaccatura a g-. \acciaccatura a g-.
>  r \acciaccatura a g-. \acciaccatura a g-.}
>   \acciaccatura a g-.
>   r r2 |
> } }
> { \new Staff \relative {
>r2 g''16-. g-. e'( c) g-. g-. e'( c) g-. g-. e'( c) |
>\tweak extra-spacing-width #'(-3 . 0) g=''16-. g-. e'( c) r4 g16-.
> g-. e'( c)
>r8 e,16-. fs-. g-. a-. b-. c-. |
> } }
>   >>
> }
> %%%
>
> If the spacer rests are replaced by normal rests, the problem goes away.
> But whole bar rests cause the problem to reappear, Even if the stave is not
> actually displayed (because \with \RemoveAllEmptyStaves has been added),
> the problem persists.
>
> This surely is a bug. Whether it is or not, it is causing me a lot of
> difficulty, because I have a part for narrator which uses a dummy stave to
> add the narrator's words as Marks. If I replace the dummy rests with normal
> rests in this stave (which has \RemoveAllEmptyStaves) the stave reappears
> on any line where the narrator has to speak, although I don't understand
> why it

Re: Modified ties for chords

2019-05-30 Thread Stefano Troncaro
Hi Niels

Unfortunately I don't know of a way of doing this without using Scheme. The
following will apply the shape you wanted to both ties:

%
\version "2.18.2"

example-offset-pairs = #'((0 . 0) (0 . 0.5) (-3 . 0.5) (-3 . 0))

music = \relative c' {
   1
   \once \override TieColumn.after-line-breaking =
   #(lambda (nc)
  (let ((ties (ly:grob-array->list (ly:grob-object nc 'ties
;(pretty-print (format "Ties: ~a" ties))
(for-each
 (lambda (tie)
   (let* ((cp (ly:tie::calc-control-points tie))
  (cp-offset example-offset-pairs)
  (new-cp
   (map
(lambda (point-pair offset-pair)
  (cons (+ (car point-pair) (car offset-pair)) (+ (cdr
point-pair) (cdr offset-pair
cp
cp-offset)))
 ;(pretty-print (format "Control points: ~a" cp))
 ;(pretty-print (format "Control point offsets: ~a" cp-offset))
 ;(pretty-print (format "Control points after applying offsets:
~a" new-cp))
 (ly:grob-set-property! tie 'control-points new-cp)
   ))
 ties)
))
   
}

\score {
  \music
  \layout{}
}
%%

I hope this serves as a base for you to create a function or set of
functions that fits your needs.

Hope that helps,
Stéfano

El jue., 30 may. 2019 a las 4:56, Niels () escribió:

> Dear users,
>
> I want to shorten the ties between chords.
> I use the following code:
>
> \version "2.18.2"
> tiea = {\shape #'((0 . 0) (0 . 0.5) (-3 . 0.5) (-3 . 0)) Tie}
> music = \relative c' {
>\tiea 1 
> }
> \score { \music
> \layout{}
> }
>
> This code shortens only the lower one.
> How can I shorten both ties?
>
> Regards, Niels
> ___
> lilypond-user mailing list
> lilypond-user@gnu.org
> https://lists.gnu.org/mailman/listinfo/lilypond-user
>
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: two-way synchronization (live or otherwise) between Lilypond and a DAW

2019-06-05 Thread Stefano Troncaro
I'd also be very interested in steps 5, 6 and 7 described by Kieren. I
usually heavily edit velocities (among other things) and making even minor
changes in the source material (the midi) is a pain. The closest I've
gotten to making the process slightly less tedious is is writing a lua
script for Reaper so I can copy and paste velocities from a group of notes
to another.

El mar., 4 jun. 2019 a las 0:48, Ivan Kuznetsov ()
escribió:

> About four years ago, I did almost all, if not all of your listed
> steps with Lilypond and Ardour.
>
> I wrote a multi-voice score in Lilypond, converted the score
> to MIDI, loaded this MIDI into Ardour, and then assigned
> the various MIDI voices to various synthesis plugins.
>
> The process did include editing the original Lilypond score
> and thus creating new MIDI voices that were used
> to replace MIDI voices that I had previously imported
> into Ardour.
>
> The process worked very well, and I would certainly
> work this way again if I needed to do such a project.
>
>
>
> On Thu, May 30, 2019 at 3:37 PM Kieren MacMillan
>  wrote:
> > At the very least, I’d like to hear if anyone has worked out (or even
> attempted) a workflow like the following:
> >
> > 1. Write a Lilypond input file.
> > 2. Use Lilypond to generate a MIDI file or files (e.g., one per staff or
> instrument/staff-group).
> > 3. Load those MIDI file(s) into a DAW.
> > 4. Make edits to the DAW file (e.g., add a tempo track, modify volumes,
> etc.).
> > and then [this is the critical part!]
> > 5. Make a change in the Lilypond input file.
> > 6. Use Lilypond to overwrite the associated MIDI files.
> > 7. See the changes reflected instantaneously in the DAW, while affecting
> ("ruining"/"reverting") the least number of changes made in the DAW in Step
> #4.
>
> ___
> lilypond-user mailing list
> lilypond-user@gnu.org
> https://lists.gnu.org/mailman/listinfo/lilypond-user
>
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Scheme question

2019-09-20 Thread Stefano Troncaro
Hi Jay, your 'if' statements are not nested properly. See:

#(define nameold
   (if (equal? pitch "C")
   nameCpitch
   (if (equal? pitch "E")
   nameEpitch
   (if (equal? pitch "G")
   nameGpitch
   (if (equal? pitch "A")
   nameApitch
   nameCpitch)

Just in case you didn't know, you can use de cond conditional for cases
like this, which is much easier to work with:

#(define nameold
   (cond
((equal? pitch "C") nameCpitch)
((equal? pitch "E") nameEpitch)
((equal? pitch "G") nameGpitch)
((equal? pitch "A") nameApitch)
(else nameCpitch)))

Hope that helps!
Stéfano

El vie., 20 sept. 2019 a las 8:14, Jay Vara () escribió:

> I have defined three pair lists nameCpitch, nameEpitch, nameGpitch and
> nameApitch.
>
> I want to assign nameold to one of the four depending on the value of
> pitch.
>
> I set pitch to G and have a set of if statements to define nameold.
>
> However it is not working.  When I print one of the lists I defined, it
> prints correctly but the list nameold does not. I imagine that someone who
> knows scheme could spot my error immediately.
>
> Here is the code
>
> 
>
> \version "2.19.83"
>
> nameCpitch =
> #`(("c" . "C")
> ("cis" . "C#")
> ("des" . "Db")
> ("d" . "D")
> ("b" . "B")
> ("bis" . "B#"))
>
> nameEpitch =
> #`(("c" . "E")
> ("cis" . "F")
> ("des" . "F")
> ("d" . "F#")
> ("b" . "D#")
> ("bis" . "E"))
> nameGpitch =
> #`(("c" . "G")
> ("cis" . "Ab")
> ("des" . "Ab")
> ("d" . "A")
> ("b" . "F#")
> ("bis" . "G"))
> nameApitch =
> #`(("c" . "A")
> ("cis" . "Bb")
> ("des" . "Bb")
> ("d" . "B")
> ("b" . "G#")
> ("bis" . "A"))
>
> pitch = G
>
> #(define nameold (if (equal? pitch "C")
>(nameCpitch (if(equal? pitch "E")
>  (nameEpitch (if (equal? pitch "G")
>(nameGpitch (if (equal? pitch "A")
>  nameApitch nameCpitch
>
> #(display nameCpitch)
>
> #(display nameold)
>
> %%
>
> ___
> lilypond-user mailing list
> lilypond-user@gnu.org
> https://lists.gnu.org/mailman/listinfo/lilypond-user
>
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: polyrhythm with multiple tempi

2019-12-11 Thread Stefano Troncaro
I've nothing to add to the discussion, but I felt the need to express that
I am completely impressed by how easily Lilypond manages this. This is
awesome!

El mié., 11 dic. 2019 a las 11:10, Kieren MacMillan (<
kieren_macmil...@sympatico.ca>) escribió:

> Hi there,
>
> > \scaleDurations does not scale the measure length as well. Try inserting
> >   \set Timing.measureLength = #(ly:make-moment 12/8)
> > in the \slower part.
>
> That’s great! Thanks.
>
> Note for future readers: the order of operations is important! The
> override must happen *after* the \time command. So the final [working]
> snippet is
>
> %%%  SNIPPET BEGINS
> \version "2.19.83"
>
> \layout {
>   \context {
> \Score
> \remove "Timing_translator"
> \remove "Default_bar_line_engraver"
> \remove "Metronome_mark_engraver"
>   }
>   \context {
> \Staff
> \consists "Timing_translator"
> \consists "Default_bar_line_engraver"
> \consists "Metronome_mark_engraver"
>   }
> }
>
> slower = {
>   \time 4/4
>   \tempo 4=90
>   \set Timing.measureLength = #(ly:make-moment 12/9)
>   \scaleDurations 120/90 {
> \repeat unfold 16 { c'4 }
>   }
> }
>
> faster = {
>   \time 4/4
>   \tempo 4=120
>   \repeat unfold 20 { c'4 }
> }
>
> \score {
>   <<
> \new Staff \slower
> \new Staff \faster
>   >>
> }
> %%%  SNIPPET ENDS
>
> > See you in Salzburg!
>
> Looking forward to it!
> Kieren.
> 
>
> Kieren MacMillan, composer (he/him/his)
> ‣ website: www.kierenmacmillan.info
> ‣ email: i...@kierenmacmillan.info
>
>
>


Re: (Pheraps) a not difficult way for modifying slurs with any SVG editor and feed Lilypond with modifications

2019-12-11 Thread Stefano Troncaro
Hi everyone

No. In fact I realized that it's not necessary anymore. I'm currently using
> the "class" attribute, set by Lilypond on the svg element, and I set it to
> the same value for all the slurs I want to modify.


Paolo, I see you wrote this while I was drafting a snippet. Here it is in
case you find it useful somehow:

\version "2.19.83"
> \language "english"
> \score {
>   <<
> \new Staff \relative { c''4( d) e( f) }
> \new PianoStaff <<
>   \new Staff \relative { 2( ) }
>   \new Staff \relative { \clef F c'2( c,) }
> >>
>   >>
>   \layout {
> \context {
>   \Score
>   \override Slur.after-line-breaking =
>   #(lambda (grob)
>  (let* ((cps (ly:grob-property grob 'control-points))
> (id "slur_1")) ;need to find how to enumerate slurs
>(ly:grob-set-nested-property! grob '(output-attributes id) id)
>(for-each
> (lambda (cp num)
>   (let* ((prefix (string-append "data-cp_" (number->string
> num)))
>  (pfx (string->symbol (string-append prefix "_x")))
>  (pfy (string->symbol (string-append prefix "_y"
> (ly:grob-set-nested-property! grob `(output-attributes
> ,pfx) (car cp))
> (ly:grob-set-nested-property! grob `(output-attributes
> ,pfy) (cdr cp))
>   ))
> cps
> '(1 2 3 4
> }
>   }
> }


It's not the most elegant but it saves the metadata in the svg file. I
couldn't figure out quickly how to enumerate the slurs but I know it can be
done, I just have to research a bit.

Let me know if I can be of use, shaping slurs is currently the most tedious
aspect of Lilypond for me, and the feature you are working on would be a
great help, so I would love to help in any way I can! Integrating it in
Frescobaldi would be even better.

El mié., 11 dic. 2019 a las 17:33, Paolo Pr ()
escribió:

>
>
> On Wed, Dec 11, 2019 at 9:13 PM Urs Liska  wrote:
>
>> Hi Paolo,
>> Am 11.12.19 um 20:36 schrieb Paolo Pr:
>>
>> Hi Urs,
>>
>> I had another idea meanwhile, which is much easier and it's 100%
>> Javascript (generated by Lilypond) inside the SVG file (then, only a common
>> browser is required, no Inkscape, Frescobaldi etc.). I'm implementing it
>> and I'll share the code with the community in the next days.
>>
>>
>> Please go ahead with whatever brings the ecosystem forward!
>>
>> However, let me state that using Frescobaldi as a framework for that
>> functionality was not a "generous offer" but rather a question. We would
>> *very* much appreciate adding such graphic curve shaping in Frescobaldi.
>> There you'd basically work in a browser too, with the added benefit of
>> having Frescobaldi's knowledge of the LilyPond language to write the tweak
>> back to the original file.
>>
>
> This is true, but given that the code is 100% Javascript I don't want to
> couple it to Frescobaldi  *for now*. When the code wil be completed (and
> working), we'll see how to integrate it in that editor.
>
>
>> Just two comments on your original post:
>>
>> 1)
>> Do you really need the IDs of the curve's control points? wouldn't they
>> somehow be available from the SVG curve object somehow?
>>
>
> No. In fact I realized that it's not necessary anymore. I'm currently
> using the "class" attribute, set by Lilypond on the svg element, and I set
> it to the same value for all the slurs I want to modify.
>
> 2)
>> For the modification please use the \shape function that is built into
>> LilyPond itself, not an LSR snippet. From the calculation perspective it's
>> probably identical to what you suggested but the input syntax is different.
>> Please have a look at
>> http://lilypond.org/doc/v2.19/Documentation/notation/modifying-shapes.en.html#modifying-ties-and-slurs
>>
>>
> Thanks. This makes the template shorter to write/test
>
> Best,
>
>


Re: A Javascript test code for modifying ties and slurs with mouse

2019-12-14 Thread Stefano Troncaro
Hi Paolo,

Since Aaron's svg-script function creates an empty \markup, you can use the
properties oddFooterMarkup and evenFooterMarkup of the \paper block to have
your script embedded at the end of every page. Look:

%%%
\version "2.19.83"

svg-script = #(define-scheme-function (body) (string?)
   (markup #:stencil (ly:make-stencil (list 'embedded-svg
 (string-join (list "") "\n")) '(0 . 0) '(0 . 0

script-for-every-page = \svg-script
#"var flat = document.getElementById('flat');
   flat.style.color = 'red';
   function spin(what, amount) {
 let angle = 0.0;
 return function () {
   const bbox = what.getBBox();
   const xform = ['rotate(',
 (angle = (angle + amount) % 360.0),
 bbox.x + 0.5 * bbox.width,
 bbox.y + 0.75 * bbox.height, ')'];
   what.setAttribute('transform', xform.join(' '));
 }
   }
   setInterval(spin(flat, 5), 100);"

\paper {
  oddFooterMarkup = \script-for-every-page
  evenFooterMarkup = \script-for-every-page
}

{ g'4 a' \tweak Accidental.output-attributes #'((id . "flat")) bes'2
\pageBreak
  g'4 a' \tweak Accidental.output-attributes #'((id . "flat")) bes'2 }
%%%

Love what your script is doing so far!

Hope that helps,
Stefano

El sáb., 14 dic. 2019 a las 18:39, Paolo Prete ()
escribió:

> Thanks Aaron, it did the trick.
>
> However, how can I make it work for multiple pages output?
>
> On Sat, Dec 14, 2019 at 4:26 AM Aaron Hill 
> wrote:
>
>> On 2019-12-13 5:59 pm, Paolo Pr wrote:
>> > First of all, I need to add with Lilypond a   tag to the svg
>> > file
>> > just before the ending  tag  in the following way:
>> >
>> > 1)
>> > 
>> >