Fw: Add option to indicate frets by letters in tablature(issue164063)

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

Fw: Add option to indicate frets by letters in tablature(issue164063)

Trevor D-2
Carl

I think I need some froggy help!

You asked

>> The fretLabels list wouldn't need to
>> be characters; they could be markups or stencils, so users could
>> define whatever is needed or desired.

and I replied
 
> I'll look at implementing markups.

but I can't find an example of mixing strings and
markup in a property to crib from, and I can't see
how to identify a markup or how to process it, other
than looking for a string starting "\markup".

Could you give me a hint or two, please?

Trevor
 




---
----
Join the Frogs!

Reply | Threaded
Open this post in threaded view
|

Re: Add option to indicate frets by letters in tablature(issue164063)

Carl Sorensen



On 12/7/09 5:03 AM, "Trevor Daniels" <[hidden email]> wrote:

> Carl
>
> I think I need some froggy help!
>
> You asked
>
>>> The fretLabels list wouldn't need to
>>> be characters; they could be markups or stencils, so users could
>>> define whatever is needed or desired.
>
> and I replied
>
>> I'll look at implementing markups.
>
> but I can't find an example of mixing strings and
> markup in a property to crib from, and I can't see
> how to identify a markup or how to process it, other
> than looking for a string starting "\markup".


I don't think there's anything special to do in terms of mixing strings or
markups in a property.  The property is just a list.

When it's time to display, you can use the string? and markup? predicates to
decide whether a given fretLabel is a string or a markup, if you need to.

Actually, as I read the code, you don't need to do anything, because
make-vcenter-markup just does interpret-markup on its argument (see
scm/define-markup-commands.scm and search for vcenter to see how this
works).  So interpret-markup will operate on the argument (either a string
or a markup) and create a stencil.

Has this helped?

Thanks,

Carl


---
----
Join the Frogs!

Reply | Threaded
Open this post in threaded view
|

Re: Add option to indicate frets by letters in tablature(issue164063)

Trevor D-2

Carl Sorensen wrote Monday, December 07, 2009 2:18 PM

>
> I don't think there's anything special to do in terms of mixing
> strings or
> markups in a property.  The property is just a list.
>
> When it's time to display, you can use the string? and markup?
> predicates to
> decide whether a given fretLabel is a string or a markup, if you
> need to.
>
> Actually, as I read the code, you don't need to do anything,
> because
> make-vcenter-markup just does interpret-markup on its argument
> (see
> scm/define-markup-commands.scm and search for vcenter to see how
> this
> works).  So interpret-markup will operate on the argument (either
> a string
> or a markup) and create a stencil.

The thing that bugging me is how do I code the fretLabels property?
I've tried every way I can think of to enter markup so
make-vcenter-markup
is happy to receive it, but they all fail in one way or another.

I think I must be missing something obvious.  As examples,

fretLabels = ("a" "b" "c") works fine, of course.

fretLabels = ("a" "b" "\markup { \italic c } ") fails with
  syntax error, unexpected ( (after the =)

fretLabels = ("a" "b" \markup { \italic c } ) fails with
  invalid markup in position 1. expect markup found \markup

etc, I've tried several other variants.

Trevor



---
----
Join the Frogs!

Reply | Threaded
Open this post in threaded view
|

Re: Add option to indicate frets by letters in tablature(issue164063)

Carl Sorensen



On 12/7/09 11:11 AM, "Trevor Daniels" <[hidden email]> wrote:

>
>
> Carl Sorensen wrote Monday, December 07, 2009 2:18 PM
>>
>> I don't think there's anything special to do in terms of mixing
>> strings or
>> markups in a property.  The property is just a list.
>>
>> When it's time to display, you can use the string? and markup?
>> predicates to
>> decide whether a given fretLabel is a string or a markup, if you
>> need to.
>>
>> Actually, as I read the code, you don't need to do anything,
>> because
>> make-vcenter-markup just does interpret-markup on its argument
>> (see
>> scm/define-markup-commands.scm and search for vcenter to see how
>> this
>> works).  So interpret-markup will operate on the argument (either
>> a string
>> or a markup) and create a stencil.
>
> The thing that bugging me is how do I code the fretLabels property?
> I've tried every way I can think of to enter markup so
> make-vcenter-markup
> is happy to receive it, but they all fail in one way or another.
>
> I think I must be missing something obvious.  As examples,
>
> fretLabels = ("a" "b" "c") works fine, of course.
>
> fretLabels = ("a" "b" "\markup { \italic c } ") fails with
>   syntax error, unexpected ( (after the =)
>
> fretLabels = ("a" "b" \markup { \italic c } ) fails with
>   invalid markup in position 1. expect markup found \markup

You need to use a Scheme markup, not a lilypond markup.

See Extending LilyPond, section 2.4.1 in the Devel Docs, or NR 6.4.1 in the
2.12 docs.

HTH,

Carl


---
----
Join the Frogs!

Reply | Threaded
Open this post in threaded view
|

Re: Add option to indicate frets by letters in tablature(issue164063)

Trevor D-2

Carl Sorensen wrote Monday, December 07, 2009 7:17 PM

>
> On 12/7/09 11:11 AM, "Trevor Daniels" <[hidden email]>
> wrote:
>>
>> Carl Sorensen wrote Monday, December 07, 2009 2:18 PM
>>>
>>> I don't think there's anything special to do in terms of mixing
>>> strings or
>>> markups in a property.  The property is just a list.
>>>
>>> Actually, as I read the code, you don't need to do anything,
>>> because
>>> make-vcenter-markup just does interpret-markup on its argument
>>> (see
>>> scm/define-markup-commands.scm and search for vcenter to see how
>>> this
>>> works).  So interpret-markup will operate on the argument
>>> (either
>>> a string
>>> or a markup) and create a stencil.
>>
>> The thing that bugging me is how do I code the fretLabels
>> property?
>> I've tried every way I can think of to enter markup so
>> make-vcenter-markup
>> is happy to receive it, but they all fail in one way or another.
>>
>> I think I must be missing something obvious.  As examples,
>>
>> fretLabels = ("a" "b" "c") works fine, of course.
>>
>> fretLabels = ("a" "b" "\markup { \italic c } ") fails with
>>   syntax error, unexpected ( (after the =)
>>
>> fretLabels = ("a" "b" \markup { \italic c } ) fails with
>>   invalid markup in position 1. expect markup found \markup
>
> You need to use a Scheme markup, not a lilypond markup.

Thanks Carl.  I had tried that earlier, and that
didn't work either.  The thing I was missing was
an eval-string function to cause the Scheme string
to be evaluated.  So, I've now got it working, but
the format is a bit convoluted.  The markup has to
be in scheme brackets in a string, which means
strings inside have to be escaped, like this:

fretLabels = #'("a" "b" "(markup #:italic #:smaller \"c\")")

Unless you can suggest a better way this is what
we shall have to go with.  We can still simply
specify the required font as an override to
TabNoteHead, so maybe markup like this will be
required only in pretty exceptional circumstances.

I'll post the new patch-set tomorrow after I've
checked it out more carefully.

Trevor



---
----
Join the Frogs!

Reply | Threaded
Open this post in threaded view
|

Re: Re: Add option to indicate frets by letters in tablature(issue164063)

Neil Puttock
2009/12/8 Trevor Daniels <[hidden email]>:

> Unless you can suggest a better way this is what
> we shall have to go with.  We can still simply
> specify the required font as an override to
> TabNoteHead, so maybe markup like this will be
> required only in pretty exceptional circumstances.

The usual method (see for example define-grobs.scm) is to use
backquote (aka quasiquote) with a comma (aka unquote):

fretLabels = #`("a" "b" ,(markup #:italic #:smaller "c"))

BTW, you still need to document this context property in
define-context-properties.scm, otherwise make all will fail.

Cheers,
Neil

---
----
Join the Frogs!

Reply | Threaded
Open this post in threaded view
|

Re: Add option to indicate frets by letters in tablature(issue164063)

Carl Sorensen
In reply to this post by Trevor D-2



On 12/7/09 5:40 PM, "Trevor Daniels" <[hidden email]> wrote:

>>
>> You need to use a Scheme markup, not a lilypond markup.
>
> Thanks Carl.  I had tried that earlier, and that
> didn't work either.  The thing I was missing was
> an eval-string function to cause the Scheme string
> to be evaluated.  So, I've now got it working, but
> the format is a bit convoluted.  The markup has to
> be in scheme brackets in a string, which means
> strings inside have to be escaped, like this:
>
> fretLabels = #'("a" "b" "(markup #:italic #:smaller \"c\")")

Have you tried

fretLabels = #`("a" "b" ,(markup #:italic #:smaller "c"))

This worked for me.  Note that the character following the # is the backtick
or accent grave character. When this expression is passed to Scheme, the
(markup #:italic #:smaller "c") is evaluated (because it has a , before it)
and the result of the evaluation (which is a markup) is stored in the list.
Then that result is ready to be passed along to make-vcenter-markup.

HTH,

Carl


---
----
Join the Frogs!

Reply | Threaded
Open this post in threaded view
|

Re: Re: Add option to indicate frets by letters in tablature(issue164063)

Carl Sorensen



On 12/7/09 6:00 PM, "Carl Sorensen" <[hidden email]> wrote:

>
>
>
>
> On 12/7/09 5:40 PM, "Trevor Daniels" <[hidden email]> wrote:
>
>>>
>>> You need to use a Scheme markup, not a lilypond markup.
>>
>> Thanks Carl.  I had tried that earlier, and that
>> didn't work either.  The thing I was missing was
>> an eval-string function to cause the Scheme string
>> to be evaluated.  So, I've now got it working, but
>> the format is a bit convoluted.  The markup has to
>> be in scheme brackets in a string, which means
>> strings inside have to be escaped, like this:
>>
>> fretLabels = #'("a" "b" "(markup #:italic #:smaller \"c\")")
>
> Have you tried
>
> fretLabels = #`("a" "b" ,(markup #:italic #:smaller "c"))
>
> This worked for me.  Note that the character following the # is the backtick
> or accent grave character. When this expression is passed to Scheme, the
> (markup #:italic #:smaller "c") is evaluated (because it has a , before it)
> and the result of the evaluation (which is a markup) is stored in the list.
> Then that result is ready to be passed along to make-vcenter-markup.
>

BTW, I used this list with the code already posted on Rietveld, so no other
modifications are necessary (of course it was fretLetterExceptions, not
fretLabels, in that code).

Thanks,

Carl



---
----
Join the Frogs!

Reply | Threaded
Open this post in threaded view
|

Re: Add option to indicate frets by letters in tablature(issue164063)

Trevor D-2
In reply to this post by Carl Sorensen

Thanks, Neil and Carl

You both said

> Have you tried
>
> fretLabels = #`("a" "b" ,(markup #:italic #:smaller "c"))

That works fine, and is somewhat easier to enter correctly.  
(And I've learned a bit more Scheme :)

Trevor



---
----
Join the Frogs!

Reply | Threaded
Open this post in threaded view
|

Re: Re: Add option to indicate frets by letters in tablature(issue164063)

Trevor D-2
In reply to this post by Trevor D-2

Trevor Daniels wrote Tuesday, December 08, 2009 12:40 AM
>
> I'll post the new patch-set tomorrow after I've
> checked it out more carefully.

This is taking a little longer than I thought.  

I've had trouble building the docs in my minimal
ubuntu virtual machine.  First I ran out of ram (or
maybe paging space, which wasn't clear), so now I
shut down all the superfluous windows while make doc
is running.  Then I ran out of disk space, so I had
to run make test-clean and make doc-clean to free up
some space, and not leave both docs and regression
tests lying around at the same time.  Then I found
I couldn't rebuild the docs from scratch, so I can't
finally check out my patches.  I'm still investigating
that.  As each attempt building the docs takes several
hours this is getting frustrating.

If you intend to do serious LilyPond development work
in a virtual machine running ubuntu I think you need
a minimum of 800Mb ram (rather than my 500Mb) in order
to continue work in other windows while make doc is
running and at least a 10Gb virtual disk (rather than
my 8Gb) if you want to keep regression tests and docs
at the same time.  Trouble is I can't really spare any
more on my laptop :(

Trevor
 


---
----
Join the Frogs!

Reply | Threaded
Open this post in threaded view
|

Re: Re: Add option to indicate frets by letters in tablature(issue164063)

Graham Percival
On Wed, Dec 09, 2009 at 08:38:34PM -0000, Trevor Daniels wrote:
> If you intend to do serious LilyPond development work
> in a virtual machine running ubuntu I think you need
> a minimum of 800Mb ram (rather than my 500Mb) in order
> to continue work in other windows while make doc is
> running and at least a 10Gb virtual disk (rather than my 8Gb) if you want
> to keep regression tests and docs
> at the same time.

Hmm.  How much free space was on the system when you got it?  I've
never used more than 2 gigs for lilypond (an SD card -- to be
fair, this is 2 gigs reserved for lilypond: full git checkout and
compiled source).

Both my netbooks have 512 Mb ram, so this can't be a problem,
either.  While compiling, I read+write emails and surf the net
with firefox.  Actually, a few months ago I would play a 3d RTS
(warzone2100) while compiling.

Granted, all bets are off when you're dealing with a virtual
machine.

Cheers,
- Graham

---
----
Join the Frogs!

Reply | Threaded
Open this post in threaded view
|

Re: Re: Add option to indicate frets by letters intablature(issue164063)

Trevor D-2

Graham Percival wrote Thursday, December 10, 2009 1:30 AM


> On Wed, Dec 09, 2009 at 08:38:34PM -0000, Trevor Daniels wrote:
>> If you intend to do serious LilyPond development work
>> in a virtual machine running ubuntu I think you need
>> a minimum of 800Mb ram (rather than my 500Mb) in order
>> to continue work in other windows while make doc is
>> running and at least a 10Gb virtual disk (rather than my 8Gb) if
>> you want
>> to keep regression tests and docs
>> at the same time.
>
> Hmm.  How much free space was on the system when you got it?

I didn't take note at the time, and since then I've upped the
release level and applied several security updates.

> I've never used more than 2 gigs for lilypond (an SD card -- to be
> fair, this is 2 gigs reserved for lilypond: full git checkout and
> compiled source).

Running make doc, make test-baseline and make check adds quite
a bit. In fact after running make doc succesfully there was 1.2Gb
free (on my nominal 8Gb virtual disk), but make test-baseline
failed before completing when it had used all this available space.
And I haven't yet run make check.

The disk analyser now shows:

home:                 3.4 Gb, of which
  git:                    3.1 Gb, of which
    input/regression          1.1 Gb (incomplete)
    out                       1.1 Gb
    out-www                   0.5 Gb
  .local                  0.3 Gb
usr:                  2.3 Gb
var:                  0.8 Gb
lib:                  0.4 Gb
... plus smaller others to fill it up

Perhaps Carl or Neil can say how large git becomes when
all the regression tests and docs are present, so I can
estimate more accurately how big I need to make my
virtual drive.

> Both my netbooks have 512 Mb ram, so this can't be a problem,
> either.  While compiling, I read+write emails and surf the net
> with firefox.  Actually, a few months ago I would play a 3d RTS
> (warzone2100) while compiling.

I think the lack of ram was more to do with the number of
open windows.  I'm used to running with quite a few in Vista
(a quick look shows 12 at the moment, it's often more), and
I probably had half-a-dozen open in ubuntu (2 consoles, mail,
browser, editor, git gui, gitk, ...  I'll have to get used to
closing windows down when I'm not actively using them.

Trevor



---
----
Join the Frogs!