Text listing output in .txt file

classic Classic list List threaded Threaded
18 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Text listing output in .txt file

Daniel Sanmartín Nieto
Hi everyone!

Is it possible to get a .txt output with a listing of text inputs written throughout the music file?

I mean, from something like:

\score {
c4 d e f
#{"text 1"#}
g a b c
#{"text 2"#}
d e f g
#{"text 3"#}
}

...to get a .txt file that contains:

text 1
text 2
text 3

I thought that this snippet from the displayMusic function could serve as basis, but I didn't get anything with it.

{
  #(with-output-to-file "display.txt"
      (lambda () #{ \displayMusic { c'4\f } #}))
}

Thanks,
Daniel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Text listing output in .txt file

Thomas Morley-2
2017-08-02 17:29 GMT+02:00 Daniel Sanmartín Nieto
<[hidden email]>:
> Hi everyone!
>
> Is it possible to get a .txt output with a listing of text inputs written
> throughout the music file?
>
> I mean, from something like:

This does not compile: there's a missing pair of brackets

> \score {
> c4 d e f

and this is not a musical expression

> #{"text 1"#}
> g a b c
> #{"text 2"#}
> d e f g
> #{"text 3"#}
> }
>
> ...to get a .txt file that contains:
>
> text 1
> text 2
> text 3
>
> I thought that this snippet from the displayMusic function could serve as
> basis, but I didn't get anything with it.
>
> {
>   #(with-output-to-file "display.txt"
>       (lambda () #{ \displayMusic { c'4\f } #}))
> }
>
> Thanks,
> Daniel



Could you be a bit more verbose about the purpose of this?
And please provide compiling ly-code.


Cheers,
  Harm

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Text listing output in .txt file

Daniel Sanmartín Nieto
It would be for "tracking" the changes made when transcribing sources for a critical edition. For example, if I change a g-sharp to a g-natural, I would like to write on a line of code "g-sharp changed to g-natural" that then would be listed on a text file that I can copy to my critical commentary.

I don't know if I've been clear enough... Unfortunately, I couldn't get any working code.

Regards.
dak
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Text listing output in .txt file

dak
Daniel Sanmartín Nieto <[hidden email]> writes:

> It would be for "tracking" the changes made when transcribing sources for a
> critical edition. For example, if I change a g-sharp to a g-natural, I would
> like to write on a line of code "g-sharp changed to g-natural" that then
> would be listed on a text file that I can copy to my critical commentary.
>
> I don't know if I've been clear enough... Unfortunately, I couldn't get any
> working code.

Sounds just like

outFile = #(open-file-output-port "whatever.txt")

...
   #(display outFile "text 1")
...
   #(display outFile "text 2")

However, I can't fathom this being actually useful for tracking anything
since the output is completely unrelated (and unrelatable) to the
context around it.  Whether you write this in the source file or right
away into whatever.txt is not making a difference.

So obviously either I or you are missing some important detail here.

--
David Kastrup

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Text listing output in .txt file

Kieren MacMillan
In reply to this post by Daniel Sanmartín Nieto
Hi Daniel,

> For example, if I change a g-sharp to a g-natural, I would
> like to write on a line of code "g-sharp changed to g-natural" that then
> would be listed on a text file that I can copy to my critical commentary.

Have you looked at the edition engraver? That kind of edition control is *precisely* its fundamental purpose — and I wouldn't think it would take much to transform a list of editionMod-s (i.e., tweaks) into a text file in any format you desired.

(Note: I use the EE extensively, in every score I engrave, but only for aesthetic/tweak purposes, not to track changes as you are suggesting.)

Hope that helps,
Kieren.
________________________________

Kieren MacMillan, composer
‣ website: www.kierenmacmillan.info
‣ email: [hidden email]


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Text listing output in .txt file

Thomas Morley-2
2017-08-02 19:02 GMT+02:00 Kieren MacMillan <[hidden email]>:

> Hi Daniel,
>
>> For example, if I change a g-sharp to a g-natural, I would
>> like to write on a line of code "g-sharp changed to g-natural" that then
>> would be listed on a text file that I can copy to my critical commentary.
>
> Have you looked at the edition engraver? That kind of edition control is *precisely* its fundamental purpose — and I wouldn't think it would take much to transform a list of editionMod-s (i.e., tweaks) into a text file in any format you desired.
>
> (Note: I use the EE extensively, in every score I engrave, but only for aesthetic/tweak purposes, not to track changes as you are suggesting.)
>
> Hope that helps,
> Kieren.



I thought of the edition-engraver as well. Has a plethora of features
and is used by people doing large real world type-setting.

Nevertheless here some coding, returning at least a little tracking info.
Though, it's a crude coding and expensive, use at own risk ;)

\version "2.19.64"

remark =
#(define-music-function (strg)(string?)
#{
  \withMusicProperty #'remark #strg <>
#})

%% writes remarks to <your-file-name>-remarks.txt
writeRemark =
#(define-void-function (mus)(ly:music?)
  (music-map
    (lambda (m)
      (if (and (music-is-of-type? m 'event-chord)
               (ly:music-property m 'remark #f))
          (let* ((log-file
                  (format #f "~a-remarks.txt" (ly:parser-output-name)))
                 (port (open-file  log-file "a"))
                 (origin (ly:music-property m 'origin)))
            (format #t "\nRemark from ~a written to: ~a" origin log-file)
            (format port "\n~a:\t~a" origin (ly:music-property m 'remark))
            (close port)
            m)
          m))
     mus)
  mus)

\writeRemark
  {
      \remark text
    c4 d e f
    \remark more-text
    g a b c
    \remark "further text: pitch is d, length 4"
    d e f g
  }


Cheers,
  Harm

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Text listing output in .txt file

Kieren MacMillan
Hi Thomas,

> I thought of the edition-engraver as well. Has a plethora of features
> and is used by people doing large real world type-setting.

Definitely.

> Nevertheless here some coding, returning at least a little tracking info.
> Though, it's a crude coding and expensive

You should open-source it!  LOL

Kieren.
________________________________

Kieren MacMillan, composer
‣ website: www.kierenmacmillan.info
‣ email: [hidden email]


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
dak
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Text listing output in .txt file

dak
In reply to this post by Thomas Morley-2
Thomas Morley <[hidden email]> writes:

> Nevertheless here some coding, returning at least a little tracking info.
> Though, it's a crude coding and expensive, use at own risk ;)
>
> \version "2.19.64"
>
> remark =
> #(define-music-function (strg)(string?)
> #{
>   \withMusicProperty #'remark #strg <>
> #})
>
> %% writes remarks to <your-file-name>-remarks.txt
> writeRemark =
> #(define-void-function (mus)(ly:music?)
>   (music-map
>     (lambda (m)
>       (if (and (music-is-of-type? m 'event-chord)
>                (ly:music-property m 'remark #f))
>           (let* ((log-file
>                   (format #f "~a-remarks.txt" (ly:parser-output-name)))
>                  (port (open-file  log-file "a"))
>                  (origin (ly:music-property m 'origin)))
>             (format #t "\nRemark from ~a written to: ~a" origin log-file)
>             (format port "\n~a:\t~a" origin (ly:music-property m 'remark))
>             (close port)
>             m)
>           m))
>      mus)
>   mus)
>
> \writeRemark
>   {
>       \remark text
>     c4 d e f
>     \remark more-text
>     g a b c
>     \remark "further text: pitch is d, length 4"
>     d e f g
>   }

A few comments: it seems overkill to produce an actual music expression
here when the purpose is to correlate input position with remarks.

While it has the advantage of only writing out expressions put into
\writeRemark, there cannot be any location different from the current
input location anyway.  And that's available as (*location*) in a scheme
function already and passing it through a music expression will just
lead to duplicates or omissions (depending on how often the music
expression is placed in a \writeRemark).

--
David Kastrup

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Text listing output in .txt file

Jan-Peter Voigt
In reply to this post by Kieren MacMillan
Hi Daniel and all others,

you wrote about a critrical edition. There is scholarly: https://github.com/openlilylib/scholarly
where you can add annotations to your score which then can be collected in another file.
If you want to use the EE for tracking, you might use \applyContext #(lambda (context) ... ) .
Of course you can use this function right inside your code.

I am not at my computer right now, so I can not provide an example (yet). But perhaps someone else can make use of this idea.

HTH
Jan-Peter

Am 2. August 2017 19:02:34 MESZ schrieb Kieren MacMillan <[hidden email]>:
Hi Daniel,

For example, if I change a g-sharp to a g-natural, I would
like to write on a line of code "g-sharp changed to g-natural" that then
would be listed on a text file that I can copy to my critical commentary.

Have you looked at the edition engraver? That kind of edition control is *precisely* its fundamental purpose — and I wouldn't think it would take much to transform a list of editionMod-s (i.e., tweaks) into a text file in any format you desired.

(Note: I use the EE extensively, in every score I engrave, but only for aesthetic/tweak purposes, not to track changes as you are suggesting.)

Hope that helps,
Kieren.



Kieren MacMillan, composer
‣ website: www.kierenmacmillan.info
‣ email: [hidden email]




lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user

--
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.
_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
dak
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Text listing output in .txt file

dak
Jan-Peter Voigt <[hidden email]> writes:

> Hi Daniel and all others,
>
> you wrote about a critrical edition. There is scholarly:
> https://github.com/openlilylib/scholarly
> where you can add annotations to your score which then can be collected in another file.
> If you want to use the EE for tracking, you might use \applyContext
> #(lambda (context) ... ) .
> Of course you can use this function right inside your code.
>
> I am not at my computer right now, so I can not provide an example
> (yet). But perhaps someone else can make use of this idea.

\applyContext is called at the time music is interpreted (usually quite
remote from the text entry).  At that point, (*location*) tends to point
to something nonsensical, and the execution of \applyContext's function
does not pass a pointer to the originating music expression (where the
origin would be recorded).

So one needs to call (*location*) in a wrapper function that then uses
the result in a closure passed to applyContext.  _If_ one goes the
applyContext route, that is.

Another option would be to have applyContext fetch the origin and make
it available in the %location fluid.  That seems a bit wasteful but
likely would not result in noticeable performance impacts.

--
David Kastrup

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Text listing output in .txt file

Thomas Morley-2
In reply to this post by Jan-Peter Voigt
2017-08-02 21:05 GMT+02:00 Jan-Peter Voigt <[hidden email]>:

> Hi Daniel and all others,
>
> you wrote about a critrical edition. There is scholarly:
> https://github.com/openlilylib/scholarly
> where you can add annotations to your score which then can be collected in
> another file.
> If you want to use the EE for tracking, you might use \applyContext #(lambda
> (context) ... ) .
> Of course you can use this function right inside your code.
>
> I am not at my computer right now, so I can not provide an example (yet).
> But perhaps someone else can make use of this idea.
>
> HTH
> Jan-Peter

Thanks David, Jan-Peter.

Probably:

remark =
#(define-music-function (strg)(string?)
#{
 \applyContext
   #(lambda (ctx)
     (let* ((log-file (format #f "~a-remarks.txt" (ly:parser-output-name)))
            (port (open-file  log-file "a")))
      (format port
              "\nAt bar ~a, position ~a, (location in the ly-file: ~a)\n\t~a"
              (ly:context-property ctx 'currentBarNumber)
              (ly:context-property ctx 'measurePosition)
              (*location*)
              strg)
       (close port)))
#})

{
  \remark text
  c4 d e f
  \remark more-text
  g a b c
  \remark "further text: pitch is d, length 4"
  d e f g
}


Cheers,
  Harm

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Text listing output in .txt file

Thomas Morley-2
In reply to this post by dak
2017-08-02 21:35 GMT+02:00 David Kastrup <[hidden email]>:

> Jan-Peter Voigt <[hidden email]> writes:
>
>> Hi Daniel and all others,
>>
>> you wrote about a critrical edition. There is scholarly:
>> https://github.com/openlilylib/scholarly
>> where you can add annotations to your score which then can be collected in another file.
>> If you want to use the EE for tracking, you might use \applyContext
>> #(lambda (context) ... ) .
>> Of course you can use this function right inside your code.
>>
>> I am not at my computer right now, so I can not provide an example
>> (yet). But perhaps someone else can make use of this idea.
>
> \applyContext is called at the time music is interpreted (usually quite
> remote from the text entry).  At that point, (*location*) tends to point
> to something nonsensical, and the execution of \applyContext's function
> does not pass a pointer to the originating music expression (where the
> origin would be recorded).
>
> So one needs to call (*location*) in a wrapper function that then uses
> the result in a closure passed to applyContext.  _If_ one goes the
> applyContext route, that is.
>
> Another option would be to have applyContext fetch the origin and make
> it available in the %location fluid.  That seems a bit wasteful but
> likely would not result in noticeable performance impacts.
>
> --
> David Kastrup



I had sent my previous mail before reading your reply here.

Having taken the applyContext-approach, I see no drawbacks currently.
Needs more testing, ofc


Cheers,
  Harm

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
dak
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Text listing output in .txt file

dak
In reply to this post by Thomas Morley-2
Thomas Morley <[hidden email]> writes:

> 2017-08-02 21:05 GMT+02:00 Jan-Peter Voigt <[hidden email]>:
>> Hi Daniel and all others,
>>
>> you wrote about a critrical edition. There is scholarly:
>> https://github.com/openlilylib/scholarly
>> where you can add annotations to your score which then can be collected in
>> another file.
>> If you want to use the EE for tracking, you might use \applyContext #(lambda
>> (context) ... ) .
>> Of course you can use this function right inside your code.
>>
>> I am not at my computer right now, so I can not provide an example (yet).
>> But perhaps someone else can make use of this idea.
>>
>> HTH
>> Jan-Peter
>
> Thanks David, Jan-Peter.
>
> Probably:
>
> remark =
> #(define-music-function (strg)(string?)
> #{
>  \applyContext
>    #(lambda (ctx)
>      (let* ((log-file (format #f "~a-remarks.txt" (ly:parser-output-name)))
>             (port (open-file  log-file "a")))
>       (format port
>               "\nAt bar ~a, position ~a, (location in the ly-file: ~a)\n\t~a"
>               (ly:context-property ctx 'currentBarNumber)
>               (ly:context-property ctx 'measurePosition)
>               (*location*)

We probably had overlapping postings.  That is _exactly_ what I had been
warning against.  At the time you evaluate (*location*) here, it will
be crap.  You need to write just location here and put a
(let ((location (*location*))) ...) around the whole lambda, or better
the whole #{ ... #} (I suspect that inside of #{ ... #}, (*location*)
may already be tainted).  At the time
lambda is actually getting called, it is too late to call *location*.
You have to do that when \remark is getting evaluated.

>               strg)
>        (close port)))
> #})
>
> {
>   \remark text
>   c4 d e f
>   \remark more-text
>   g a b c
>   \remark "further text: pitch is d, length 4"
>   d e f g
> }
>
>
> Cheers,
>   Harm
>

--
David Kastrup

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
dak
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Text listing output in .txt file

dak
In reply to this post by Thomas Morley-2
Thomas Morley <[hidden email]> writes:

> 2017-08-02 21:35 GMT+02:00 David Kastrup <[hidden email]>:
>> Jan-Peter Voigt <[hidden email]> writes:
>>
>>> Hi Daniel and all others,
>>>
>>> you wrote about a critrical edition. There is scholarly:
>>> https://github.com/openlilylib/scholarly
>>> where you can add annotations to your score which then can be
>>> collected in another file.
>>> If you want to use the EE for tracking, you might use \applyContext
>>> #(lambda (context) ... ) .
>>> Of course you can use this function right inside your code.
>>>
>>> I am not at my computer right now, so I can not provide an example
>>> (yet). But perhaps someone else can make use of this idea.
>>
>> \applyContext is called at the time music is interpreted (usually quite
>> remote from the text entry).

Correction, sigh: the function handed to \applyContext is called at the
time music is iterated.  \applyContext itself is obviously called at the
time it is encountered in the input.

>> At that point, (*location*) tends to point to something nonsensical,
>> and the execution of \applyContext's function does not pass a pointer
>> to the originating music expression (where the origin would be
>> recorded).
>>
>> So one needs to call (*location*) in a wrapper function that then uses
>> the result in a closure passed to applyContext.  _If_ one goes the
>> applyContext route, that is.
>>
>> Another option would be to have applyContext fetch the origin and make
>> it available in the %location fluid.  That seems a bit wasteful but
>> likely would not result in noticeable performance impacts.
>
> I had sent my previous mail before reading your reply here.
>
> Having taken the applyContext-approach, I see no drawbacks currently.
> Needs more testing, ofc

I'm pretty sure that...  Wait.

commit 99d6bb300e425bb86301eb370b0e9c57de9ee817
Author: David Kastrup <[hidden email]>
Date:   Sat Jul 4 16:43:03 2015 +0200

    Issue 4481: \barNumberCheck has bad error location

diff --git a/lily/apply-context-iterator.cc b/lily/apply-context-iterator.cc
index ce3fd032e2..5ed628491c 100644
--- a/lily/apply-context-iterator.cc
+++ b/lily/apply-context-iterator.cc
@@ -35,9 +35,9 @@ void
 Apply_context_iterator::process (Moment m)
 {
   SCM proc = get_music ()->get_property ("procedure");
-
   if (ly_is_procedure (proc))
-    scm_call_1 (proc, get_outlet ()->self_scm ());
+    with_location (get_music ()->get_property ("origin"),
+                   proc, get_outlet ()->self_scm ());
   else
     get_music ()->origin ()->warning (_ ("\\applycontext argument is not a procedure"));

Darn it.  Forget what I said unless we are talking about version 2.19.22
exactly.  I fixed this in 2.19.23 for \applyContext already.

--
David Kastrup

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Text listing output in .txt file

Thomas Morley-2
2017-08-02 21:59 GMT+02:00 David Kastrup <[hidden email]>:

> Thomas Morley <[hidden email]> writes:
>
>> 2017-08-02 21:35 GMT+02:00 David Kastrup <[hidden email]>:
>>> Jan-Peter Voigt <[hidden email]> writes:
>>>
>>>> Hi Daniel and all others,
>>>>
>>>> you wrote about a critrical edition. There is scholarly:
>>>> https://github.com/openlilylib/scholarly
>>>> where you can add annotations to your score which then can be
>>>> collected in another file.
>>>> If you want to use the EE for tracking, you might use \applyContext
>>>> #(lambda (context) ... ) .
>>>> Of course you can use this function right inside your code.
>>>>
>>>> I am not at my computer right now, so I can not provide an example
>>>> (yet). But perhaps someone else can make use of this idea.
>>>
>>> \applyContext is called at the time music is interpreted (usually quite
>>> remote from the text entry).
>
> Correction, sigh: the function handed to \applyContext is called at the
> time music is iterated.  \applyContext itself is obviously called at the
> time it is encountered in the input.
>
>>> At that point, (*location*) tends to point to something nonsensical,
>>> and the execution of \applyContext's function does not pass a pointer
>>> to the originating music expression (where the origin would be
>>> recorded).
>>>
>>> So one needs to call (*location*) in a wrapper function that then uses
>>> the result in a closure passed to applyContext.  _If_ one goes the
>>> applyContext route, that is.
>>>
>>> Another option would be to have applyContext fetch the origin and make
>>> it available in the %location fluid.  That seems a bit wasteful but
>>> likely would not result in noticeable performance impacts.
>>
>> I had sent my previous mail before reading your reply here.
>>
>> Having taken the applyContext-approach, I see no drawbacks currently.
>> Needs more testing, ofc
>
> I'm pretty sure that...  Wait.
>
> commit 99d6bb300e425bb86301eb370b0e9c57de9ee817
> Author: David Kastrup <[hidden email]>
> Date:   Sat Jul 4 16:43:03 2015 +0200
>
>     Issue 4481: \barNumberCheck has bad error location
>
> diff --git a/lily/apply-context-iterator.cc b/lily/apply-context-iterator.cc
> index ce3fd032e2..5ed628491c 100644
> --- a/lily/apply-context-iterator.cc
> +++ b/lily/apply-context-iterator.cc
> @@ -35,9 +35,9 @@ void
>  Apply_context_iterator::process (Moment m)
>  {
>    SCM proc = get_music ()->get_property ("procedure");
> -
>    if (ly_is_procedure (proc))
> -    scm_call_1 (proc, get_outlet ()->self_scm ());
> +    with_location (get_music ()->get_property ("origin"),
> +                   proc, get_outlet ()->self_scm ());
>    else
>      get_music ()->origin ()->warning (_ ("\\applycontext argument is not a procedure"));
>
> Darn it.  Forget what I said unless we are talking about version 2.19.22
> exactly.  I fixed this in 2.19.23 for \applyContext already.
>
> --
> David Kastrup

LOL

-Harm

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Text listing output in .txt file

Daniel Sanmartín Nieto
Thanks all,

I'll try to answer all of you.

dak:
The only difference is to have the "record of changes" on the engraving file itself, because I think that this is much more practical to my purposes that the classical method of anotating the changes on a separate file.

Kieren and Jan-Peter:
I read some posts about the advantages of the edition-engraver and scholarly packages on the Scores of Beauty blog one year ago or so, so I knew them... Very unfortunately, when I tried to install them a few weeks ago, Urs Liska and I found that there are some problems with the installation of the openlilylib on Windows 10 (in fact, I arrived to this mailing list for this issue), so I couldn't implement it. Now I'm only trying to find a very simple alternative for this function of tracking.

Thomas:
Thank you very much for the code. I'll make some tests with it tomorrow. It's quite hard for me to understand it, but I think that it's exactly what I'm looking for.
I don't know if it only happens to me, but after 3 years using LilyPond and having done lots of plain chant and mensural music transcriptions, historical tablatures, lead sheets, orchestral parts and quite weird things, when I see more of 10 lines of Scheme code I only want to turn around and run fast. LilyPond is a really a complex tool...

Best regards,
Daniel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Text listing output in .txt file

Thomas Morley-2
2017-08-02 23:38 GMT+02:00 Daniel Sanmartín Nieto
<[hidden email]>:

> I don't know if it only happens to me, but after 3 years using LilyPond and
> having done lots of plain chant and mensural music transcriptions,
> historical tablatures, lead sheets, orchestral parts and quite weird things,
> when I see more of 10 lines of Scheme code I only want to turn around and
> run fast. LilyPond is a really a complex tool...

I could put all in one line, if that helps. I have some doubts, tho'.

lol,
  Harm

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Text listing output in .txt file

mskala
In reply to this post by Daniel Sanmartín Nieto
On Wed, 2 Aug 2017, Daniel Sanmartín Nieto wrote:
> Is it possible to get a .txt output with a listing of text inputs written
> throughout the music file?

Does this have to be done all in Lilypond?  Because it would be trivial to
write your bits of text as comments with "%" and then extract them
into a separate file using an external utility like grep or perl.
Something like:

{
  c4 d e f |
% text 1
  g f e d |
% text 2
}

and then

grep '%' score.ly > score.txt

which would give

% text 1
% text 2

or, more elegantly because it separates out just the comment text,

perl -ne 'print "$1" if /%\s*(.*)/' score.ly > score.txt

--
Matthew Skala
[hidden email]                 People before principles.
http://ansuz.sooke.bc.ca/
_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Loading...