Re: turning a markuplist into a chain of [individual] markups or strings

2020-01-22 Thread Kieren MacMillan
Hi David,

> One element per note is tricky.  How about making this a music
> function instead that outputs lyrics?
> 
> diffints =
> #(define-music-function (mus) (ly:music?)
>  #{ \lyricmode { $@(map ...) } #})

For my current purposes, that’s perfect — thanks.

My need (as originally stated) for a markup-list to be split is now more 
curiosity than necessity, so no need to spend more time on it unless you feel 
inspired.

Thanks!
Kieren.


Kieren MacMillan, composer (he/him/his)
‣ website: www.kierenmacmillan.info
‣ email: i...@kierenmacmillan.info




Re: turning a markuplist into a chain of [individual] markups or strings

2020-01-22 Thread David Kastrup
David Kastrup  writes:

> Kieren MacMillan  writes:
>
>> Hi David,
>>
>>> Uh, a markuplist typically _is_ a list of markups.  Except when it isn't
>>> (like when it is the result of calling a markup list command).  But when
>>> it isn't, you can only turn it into a list of stencils.
>>
>> Hmmm… So in my function
>>
>> #(define-markup-list-command (diffints layout props mus) (ly:music?)
>>(interpret-markup-list layout props
>>  (map (lambda (d) (if (zero? d) "0" (format #f "~@d" d)))
>>(let ((muspst (map ly:pitch-semitones (music-pitches mus
>>  (map - (cdr muspst) muspst)
>>
>> how can I output something where I can throw it into a Lyrics context and 
>> have it spaced out one element per note?
>
> Oh.  One element per note is tricky.  How about making this a music
> function instead that outputs lyrics?
>
> diffints =
> #(define-music-function (mus) (ly:music?)
>   #{ \lyricmode { $@(map ...) } #})
>
> That's what I can suggest for now.  But that request seems legitimate
> enough that I'll see what it takes to make lyricmode accept a markup
> list.  You'd use it presumably as
>
> \markuplist [optional duration]

Ah right.  A markup list can be a markup list command, and the markup
list command code is executed at typesetting time, based on current grob
properties.  The length of the markup list is not known before that
point of time, so it is hard to produce a proper expression before that.

In short, this is a lot more involved that it would appear at first
sight.  One would probably use a sequential expression with an
elements-callback .

-- 
David Kastrup



Re: turning a markuplist into a chain of [individual] markups or strings

2020-01-22 Thread David Kastrup
Kieren MacMillan  writes:

> Hi David,
>
>> Uh, a markuplist typically _is_ a list of markups.  Except when it isn't
>> (like when it is the result of calling a markup list command).  But when
>> it isn't, you can only turn it into a list of stencils.
>
> Hmmm… So in my function
>
> #(define-markup-list-command (diffints layout props mus) (ly:music?)
>(interpret-markup-list layout props
>  (map (lambda (d) (if (zero? d) "0" (format #f "~@d" d)))
>(let ((muspst (map ly:pitch-semitones (music-pitches mus
>  (map - (cdr muspst) muspst)
>
> how can I output something where I can throw it into a Lyrics context and 
> have it spaced out one element per note?

Oh.  One element per note is tricky.  How about making this a music
function instead that outputs lyrics?

diffints =
#(define-music-function (mus) (ly:music?)
  #{ \lyricmode { $@(map ...) } #})

That's what I can suggest for now.  But that request seems legitimate
enough that I'll see what it takes to make lyricmode accept a markup
list.  You'd use it presumably as

\markuplist [optional duration]

But I have no idea what to do with things like hyphens at the end.
Probably attach them to the last element.  And the duration would likely
be for all of the syllables?  Or just the last?  Not that it would be
important since one would usually just use this in \lyricsto stuff where
the syllable length gets overridden.

-- 
David Kastrup



Re: turning a markuplist into a chain of [individual] markups or strings

2020-01-22 Thread Kieren MacMillan
Hi David,

> Uh, a markuplist typically _is_ a list of markups.  Except when it isn't
> (like when it is the result of calling a markup list command).  But when
> it isn't, you can only turn it into a list of stencils.

Hmmm… So in my function

#(define-markup-list-command (diffints layout props mus) (ly:music?)
   (interpret-markup-list layout props
 (map (lambda (d) (if (zero? d) "0" (format #f "~@d" d)))
   (let ((muspst (map ly:pitch-semitones (music-pitches mus
 (map - (cdr muspst) muspst)

how can I output something where I can throw it into a Lyrics context and have 
it spaced out one element per note?

Thanks,
Kieren.


Kieren MacMillan, composer (he/him/his)
‣ website: www.kierenmacmillan.info
‣ email: i...@kierenmacmillan.info




Re: turning a markuplist into a chain of [individual] markups or strings

2020-01-22 Thread David Kastrup
Kieren MacMillan  writes:

> Hi all,
>
> Is there a way to turn a markuplist into individual markups or strings?
>
> I have a markuplist of lyrics
>
> (a b c)
>
> and I’d like to turn that into a chain of markups
>
>\lyricmode { \markup a \markup b \markup c }
>
> or strings
>
> \lyricmode { "a" "b" "c" }
>
> What function do I use?

Uh, a markuplist typically _is_ a list of markups.  Except when it isn't
(like when it is the result of calling a markup list command).  But when
it isn't, you can only turn it into a list of stencils.

-- 
David Kastrup



turning a markuplist into a chain of [individual] markups or strings

2020-01-21 Thread Kieren MacMillan
Hi all,

Is there a way to turn a markuplist into individual markups or strings?

I have a markuplist of lyrics

(a b c)

and I’d like to turn that into a chain of markups

   \lyricmode { \markup a \markup b \markup c }

or strings

\lyricmode { "a" "b" "c" }

What function do I use?

Thanks,
Kieren.


Kieren MacMillan, composer (he/him/his)
‣ website: www.kierenmacmillan.info
‣ email: i...@kierenmacmillan.info