LilyPond processing mode

classic Classic list List threaded Threaded
8 messages Options
J L
Reply | Threaded
Open this post in threaded view
|

LilyPond processing mode

J L
Hi,

I remember reading some time ago that someone said that the part of running
lilypond that takes the most time is when lilypond loads guile. That seems
to be quite true, as lilypond can process heaps of little music fragments
(when using lily-book) quite quickly.

So, would it be possible to add a mode to lilypond, where you load lilypond,
and keep it sitting there on standby. Then, when you want a score typeset,
you tell lilypond the file to use (or drag it into the window). Lilypond
then processes the file as normal, but stays 'alive' after that. This might
be a useful feature to have, especially when doing tweaks.

Aligorith

_________________________________________________________________
Need more speed? Get Xtra Broadband @
http://jetstream.xtra.co.nz/chm/0,,202853-1000,00.html



_______________________________________________
lilypond-devel mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|

Re: LilyPond processing mode

Han-Wen Nienhuys
J L wrote:

> Hi,
>
> I remember reading some time ago that someone said that the part of
> running lilypond that takes the most time is when lilypond loads guile.
> That seems to be quite true, as lilypond can process heaps of little
> music fragments (when using lily-book) quite quickly.
>
> So, would it be possible to add a mode to lilypond, where you load
> lilypond, and keep it sitting there on standby. Then, when you want a
> score typeset, you tell lilypond the file to use (or drag it into the
> window). Lilypond then processes the file as normal, but stays 'alive'
> after that. This might be a useful feature to have, especially when
> doing tweaks.

This is quite easy to add, since the LilyPond mainloop is also coded in
Scheme, but why do you need it? It would only save 1 second or so on a
run, typically much less than the time you spend dragging the file.


--
  Han-Wen Nienhuys - [hidden email] - http://www.xs4all.nl/~hanwen


_______________________________________________
lilypond-devel mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|

Re: LilyPond processing mode

Graham Percival-2

On 5-Nov-05, at 2:55 AM, Han-Wen Nienhuys wrote:

> J L wrote:
>> So, would it be possible to add a mode to lilypond, where you load
>> lilypond, and keep it sitting there on standby. Then, when you want a
>> score typeset, you tell lilypond the file to use (or drag it into the
>> window). Lilypond then processes the file as normal, but stays
>> 'alive' after that. This might be a useful feature to have,
>> especially when doing tweaks.
>
> This is quite easy to add, since the LilyPond mainloop is also coded
> in Scheme, but why do you need it? It would only save 1 second or so
> on a run, typically much less than the time you spend dragging the
> file.

Seriously?!  Please please please!

I'm currently in discussions about arranging a Masters degree (to start
next Sep), using lilypond (and chuck and/or pd and/or Max) to create
interactive music for a string quartet.  The lilypond portion of this
involves compiling many short fragments of music.  (ie display 4 bars,
computer listens to performers and creates another 4 bars, displays
them, etc)

I think I can avoid the latency issues by creating the music one system
in advance... but still, saving 1 second for each run would be great!  
Especially if I wanted to try having one computer displaying parts for
two (or even four) people.

Cheers,
- Graham



_______________________________________________
lilypond-devel mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|

Re: LilyPond processing mode

Han-Wen Nienhuys
Graham Percivalwrote:

>> So, would it be possible to add a mode to lilypond, where you load
>>> lilypond, and keep it sitting there on standby. Then, when you want a
>>> score typeset, you tell lilypond the file to use (or drag it into the
>>> window). Lilypond then processes the file as normal, but stays
>>> 'alive' after that. This might be a useful feature to have,
>>> especially when doing tweaks.

>> This is quite easy to add, since the LilyPond mainloop is also coded
>> in Scheme, but why do you need it? It would only save 1 second or so
>> on a run, typically much less than the time you spend dragging the file.
>
>
> Seriously?!  Please please please!

see attached; the file will listne on port 2904 for a quoted string, and
process that as .ly; of course, this is one of many options.

I had to apply a small fix, so use with CVS.

muurbloem:~/src/lilypond$ lilypond foo &
[1] 30388
muurbloem:~/src/lilypond$ GNU LilyPond 2.7.16
Processing `foo.ly'
Parsing...Listening for clients in pid: 30388

muurbloem:~/src/lilypond$
muurbloem:~/src/lilypond$  telnet localhost 2904
Trying 127.0.0.1...
Got new client connection: #(2 2130706433 57450)
Client address: #("localhost.localdomain" ("muurbloem" "localhost") 2 4
(2130706433))
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
hello LilyPond 2.7.16
" \\relative { f g a } "

Interpreting music... [1]
Preprocessing graphical objects...
Calculating line breaks... [2]
Calculating page breaks...
Layout output to `foo.ps'...
Converting to `foo.pdf'...Connection closed by foreign host.

Interpreting music... [1]
Preprocessing graphical objects...
Calculating line breaks... [2]
Calculating page breaks...
Layout output to `foo-1.ps'...muurbloem:~/src/lilypond$
Converting to `foo-1.pdf'...Finished. Time elapsed: 6.93

> I think I can avoid the latency issues by creating the music one system
> in advance... but still, saving 1 second for each run would be great!  
> Especially if I wanted to try having one computer displaying parts for
> two (or even four) people.

Cool project; I suspect it will be a lot of work to glue together all
the parts.

--
  Han-Wen Nienhuys - [hidden email] - http://www.xs4all.nl/~hanwen



#(if #t
  (let ((s (socket PF_INET SOCK_STREAM 0)))
       (setsockopt s SOL_SOCKET SO_REUSEADDR 1)
       (bind s AF_INET INADDR_ANY 2904)
       (listen s 5)

       (simple-format #t "Listening for clients in pid: ~S" (getpid))
       (newline)

       (while #t
              (let* ((client-connection (accept s))
                     (start-time (get-internal-real-time))
                     (client-details (cdr client-connection))
                     (client (car client-connection)))
                (simple-format #t "Got new client connection: ~S"
                               client-details)
                (newline)
                (simple-format #t "Client address: ~S"
                               (gethostbyaddr
                                (sockaddr:addr client-details)))
                (newline)
                ;; Send back the greeting to the client port
                (display (format
                          "hello LilyPond ~a\n"
                          (lilypond-version))
                          client)

               (let* ((question (read client))
                      (result (ly:parse-string-result
                               (format " \\notemode {  ~a } " question)
                               (ly:clone-parser parser))))
                     
                (print-music-as-book parser result)
                (close client)

                (print-music-as-book parser result)
                (display (format "Finished. Time elapsed: ~a\n"
                          (/ (- (get-internal-real-time) start-time)
                           (* 1.0 internal-time-units-per-second))

                        ))
                (gc) ; do GC while app is refreshing the screen.
              )))))


_______________________________________________
lilypond-devel mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|

Re: LilyPond processing mode

Graham Percival-2

On 5-Nov-05, at 5:11 PM, Han-Wen Nienhuys wrote:

> Graham Percivalwrote:
>> Seriously?!  Please please please!
>
> see attached; the file will listne on port 2904 for a quoted string,
> and process that as .ly; of course, this is one of many options.

Thanks!

>> I think I can avoid the latency issues by creating the music one
>> system in advance... but still, saving 1 second for each run would be
>> great!  Especially if I wanted to try having one computer displaying
>> parts for two (or even four) people.
>
> Cool project; I suspect it will be a lot of work to glue together all
> the parts.

Yes and no -- it depends on how nice I want it to act.  How much time I
spend on the infrastructure vs. the musicality and algorithms is
something we'll be determining later.

I already have it working (on a single computer) in chuck and pd.  In
both languages, I simply write lilypond code into a text file, call
lilypond on that file, then call "open foo.pdf" (which in osx opens it
up in Preview, of course).

My first example was called "sadism" -- it began by giving the cellist
random notes from a D major traid, and listened to the intonation.  The
worse the intonation was, the harder the notes got (ie more distance
between notes, notes outside of the scale, etc).  It was surprisingly
easy to make... but of course, that was just a simple example, for a
single musician, on a single platform.

I could easily extend that to a quartet -- have one laptop for each
member of the quartet, with a directory of a fifth laptop remotely
mounted.  Whenever a new .ly file appears in there, the quartet member
laptops copy it to themselves, run lilypond, etc.  Of course, this is
quite inefficient; I'll definitely do something better than this.  But
how much better is still an open question.  :)

Cheers,
- Graham



_______________________________________________
lilypond-devel mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|

Re: LilyPond processing mode

Peter Leschev-2
In reply to this post by Han-Wen Nienhuys
Hi,

                I'm having problems trying to get processing mode up and
running using the Windows version of Lilypond (I'm unable to test with other
versions). I've tried versions 2.7.18 & 2.7.19.

                I'm able to run it in guile, but it doesn't work in
lilypond.

$ /cygdrive/c/Program\ Files/LilyPond/usr/bin/guile -s socket-setup.scm
Listening for clients in pid: 832
Got new client connection: #(2 2130706433 1714)
Client address: #("localhost" () 2 4 (2130706433))

        Killing the above process and trying:

$ /cygdrive/c/Program\ Files/LilyPond/usr/bin/lilypond.exe socket-setup.ly
GNU LilyPond 2.7.19
Processing `socket-setup.ly'
Parsing...ERROR: In procedure socket:
ERROR: No such file or directory

            I get the same symptoms from a DOS prompt. Could it be that it
can't find some required libraries?

Cheers,
Peter

----- Original Message -----
From: "Han-Wen Nienhuys" <[hidden email]>
To: "Graham Percival" <[hidden email]>
Cc: "lily-devel" <[hidden email]>
Sent: Sunday, November 06, 2005 12:11 PM
Subject: Re: LilyPond processing mode


> Graham Percivalwrote:
>
>>> So, would it be possible to add a mode to lilypond, where you load
>>>> lilypond, and keep it sitting there on standby. Then, when you want a
>>>> score typeset, you tell lilypond the file to use (or drag it into the
>>>> window). Lilypond then processes the file as normal, but stays
>>>> 'alive' after that. This might be a useful feature to have,
>>>> especially when doing tweaks.
>
>>> This is quite easy to add, since the LilyPond mainloop is also coded
>>> in Scheme, but why do you need it? It would only save 1 second or so
>>> on a run, typically much less than the time you spend dragging the file.
>>
>>
>> Seriously?!  Please please please!
>
> see attached; the file will listne on port 2904 for a quoted string, and
> process that as .ly; of course, this is one of many options.
>
> I had to apply a small fix, so use with CVS.
>
> muurbloem:~/src/lilypond$ lilypond foo &
> [1] 30388
> muurbloem:~/src/lilypond$ GNU LilyPond 2.7.16
> Processing `foo.ly'
> Parsing...Listening for clients in pid: 30388
>
> muurbloem:~/src/lilypond$
> muurbloem:~/src/lilypond$  telnet localhost 2904
> Trying 127.0.0.1...
> Got new client connection: #(2 2130706433 57450)
> Client address: #("localhost.localdomain" ("muurbloem" "localhost") 2 4
> (2130706433))
> Connected to localhost.localdomain (127.0.0.1).
> Escape character is '^]'.
> hello LilyPond 2.7.16
> " \\relative { f g a } "
>
> Interpreting music... [1]
> Preprocessing graphical objects...
> Calculating line breaks... [2]
> Calculating page breaks...
> Layout output to `foo.ps'...
> Converting to `foo.pdf'...Connection closed by foreign host.
>
> Interpreting music... [1]
> Preprocessing graphical objects...
> Calculating line breaks... [2]
> Calculating page breaks...
> Layout output to `foo-1.ps'...muurbloem:~/src/lilypond$
> Converting to `foo-1.pdf'...Finished. Time elapsed: 6.93
>
>> I think I can avoid the latency issues by creating the music one system
>> in advance... but still, saving 1 second for each run would be great!
>> Especially if I wanted to try having one computer displaying parts for
>> two (or even four) people.
>
> Cool project; I suspect it will be a lot of work to glue together all
> the parts.
>
> --
>  Han-Wen Nienhuys - [hidden email] - http://www.xs4all.nl/~hanwen
>

--------------------------------------------------------------------------------


>
>
> #(if #t
>  (let ((s (socket PF_INET SOCK_STREAM 0)))
>       (setsockopt s SOL_SOCKET SO_REUSEADDR 1)
>       (bind s AF_INET INADDR_ANY 2904)
>       (listen s 5)
>
>       (simple-format #t "Listening for clients in pid: ~S" (getpid))
>       (newline)
>
>       (while #t
>              (let* ((client-connection (accept s))
>                     (start-time (get-internal-real-time))
>                     (client-details (cdr client-connection))
>                     (client (car client-connection)))
>                (simple-format #t "Got new client connection: ~S"
>                               client-details)
>                (newline)
>                (simple-format #t "Client address: ~S"
>                               (gethostbyaddr
>                                (sockaddr:addr client-details)))
>                (newline)
>                ;; Send back the greeting to the client port
>                (display (format
>                          "hello LilyPond ~a\n"
>                          (lilypond-version))
>                          client)
>
>               (let* ((question (read client))
>       (result (ly:parse-string-result
>        (format " \\notemode {  ~a } " question)
>        (ly:clone-parser parser))))
>
> (print-music-as-book parser result)
>                (close client)
>
> (print-music-as-book parser result)
>                (display (format "Finished. Time elapsed: ~a\n"
>                          (/ (- (get-internal-real-time) start-time)
>    (* 1.0 internal-time-units-per-second))
>
>                        ))
>                (gc) ; do GC while app is refreshing the screen.
>              )))))
>
>

--------------------------------------------------------------------------------


> _______________________________________________
> lilypond-devel mailing list
> [hidden email]
> http://lists.gnu.org/mailman/listinfo/lilypond-devel
>

_______________________________________________
lilypond-devel mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-devel

socket-setup.scm (1017 bytes) Download Attachment
socket-setup.ly (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: LilyPond processing mode

Han-Wen Nienhuys
Peter Leschev wrote:

> Hi,
>
>                I'm having problems trying to get processing mode up and
> running using the Windows version of Lilypond (I'm unable to test with
> other
> versions). I've tried versions 2.7.18 & 2.7.19.
>
>                I'm able to run it in guile, but it doesn't work in
> lilypond.
>
> $ /cygdrive/c/Program\ Files/LilyPond/usr/bin/guile -s socket-setup.scm
> Listening for clients in pid: 832
> Got new client connection: #(2 2130706433 1714)
> Client address: #("localhost" () 2 4 (2130706433))
>
>        Killing the above process and trying:
>
> $ /cygdrive/c/Program\ Files/LilyPond/usr/bin/lilypond.exe socket-setup.ly
> GNU LilyPond 2.7.19
> Processing `socket-setup.ly'
> Parsing...ERROR: In procedure socket:
> ERROR: No such file or directory
>
>            I get the same symptoms from a DOS prompt. Could it be that
> it can't find some required libraries?

It's very likely that windows networking is sufficiently different from
Unix networking that it doesn't work on windows. You might have better
luck with Cygwin, though.

--
  Han-Wen Nienhuys - [hidden email] - http://www.xs4all.nl/~hanwen


_______________________________________________
lilypond-devel mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|

Re: LilyPond processing mode

Jan Nieuwenhuizen
In reply to this post by Peter Leschev-2
Peter Leschev writes:

>                I'm able to run it in guile, but it doesn't work in
> lilypond.

That's odd.

>            I get the same symptoms from a DOS prompt. Could it be that
>            it can't find some required libraries?

It could very well be that lilypond and guile find and use different
scm libraries.  You are running the mingw lilypond and guile, but have
cygwin installed too.

When you run lilypond.exe it will set GUILE_LOAD_PATH to make sure
that guile reads from .../LilyPond/usr/share/guile.  But when you run
plain guile.exe, it will look for guile libraries in /usr/share/guile/...

You may try some experiments with removing Cygwin's guile and
lilypond, or not using mingw at all.

Jan.

--
Jan Nieuwenhuizen <[hidden email]> | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien       | http://www.lilypond.org


_______________________________________________
lilypond-devel mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-devel