A new extension for including Lilypond

16 views
Skip to first unread message

Wei-Wei Guo

unread,
Apr 5, 2009, 10:41:26 PM4/5/09
to sphin...@googlegroups.com
Dear all,

I made a extension for including Lilypond music notes. I made the extension
by modifying mathbase.py and pngmath.py. Most codes are copied and pasted
with some tiny changes. I don't know whether it is ok and I also don't know
what to put in the :copyright: area, so I just put my name there. If you
know what to put, please tell me.

The functionalities of the extension are:

- A new role 'lily'. the 'lily' role can input a standalone music markup.
For example, a G clef can be inserted by

:lily:`clefs.G`

The purpose of the 'lily' role is writing music comments or learning notes.
So only one markup is allowed.

- A new directive 'lily'. The 'lily' directive can input a piece of music
script, for example,

.. lily::

\relative c'' {
c4 a d c
}

- A new config 'pnglily_fontsize', which can be used to set fontsize of
'lily' role and 'lily' directive.

pnglily_fontsize = ['6', '-3']

The first value is for 'lily' role setting in absolute fontsize. The
second value is for 'lily' directive setting in relative fontsize.


Hope you enjoy with it!


Best wishes,
Wei-Wei

lilypond.py

Guenter Milde

unread,
Apr 7, 2009, 5:49:13 AM4/7/09
to sphin...@googlegroups.com
On 2009-04-06, Wei-Wei Guo wrote:

> I made a extension for including Lilypond music notes. I made the extension
> by modifying mathbase.py and pngmath.py.

Thanks for the extension. This might be also interesting for the Docutils,
so that stand-alone documents can be created. Maybe as a sandbox project.

> Most codes are copied and pasted with some tiny changes. I don't know
> whether it is ok and I also don't know what to put in the :copyright:
> area, so I just put my name there. If you know what to put, please tell
> me.

You should state where you copied code from near the copyright note.
As the file is UTF-8 encoded adding a copyright sign like

> :copyright: Copyright ©2009 by Wei-Wei Guo.

adds clarity.

For LaTeX export, the lilypond-book extension could be used (just
output the code in "lilypond" environments).

Günter

Wei-Wei Guo

unread,
Apr 7, 2009, 10:05:37 PM4/7/09
to sphin...@googlegroups.com
Thanks, Günter.

I changed the preamble of the extension and made some changes, so I attach it
here again.

Now the G clef should be inserted by

:lily:`\musicglyph #"clefs.G"`

Guenter Milde 写道:


> On 2009-04-06, Wei-Wei Guo wrote:
>
>> I made a extension for including Lilypond music notes. I made the extension
>> by modifying mathbase.py and pngmath.py.
>
> Thanks for the extension. This might be also interesting for the Docutils,
> so that stand-alone documents can be created. Maybe as a sandbox project.

Maybe lilypond-book is better for stand-alone documents. And the extension still
has many things needed to be done with the 'lily' role....

Best wishes,
Wei-Wei

Wei-Wei Guo

unread,
Apr 7, 2009, 10:07:34 PM4/7/09
to sphin...@googlegroups.com
Sorry I forgot the attachment.


Guenter Milde 写道:

lilypond.py

Luc Saffre

unread,
Feb 27, 2011, 3:49:23 PM2/27/11
to sphin...@googlegroups.com
Wow! Thanks for your work. I discovered it only now, but was delighted
to see that it worked out of the box.
It would be interesting to enhance the configurabilty (lyrics font,
vertical spacing...).

Wouldn't it be good to integrate this module into Sphinx? Or is it
better to create a separate project at code.google or sourceforge?

I'm basically willing to contribute, maybe with patches but at least
with ideas. OTOH I'm doing this in my spare time, and currently I have
no urgent concrete usage for it.

Luc

> --~--~---------~--~----~------------~-------~--~----~
> You received this message because you are subscribed to the Google Groups "sphinx-dev" group.
> To post to this group, send email to sphin...@googlegroups.com
> To unsubscribe from this group, send email to sphinx-dev+...@googlegroups.com
> For more options, visit this group at http://groups.google.com/group/sphinx-dev?hl=en
> -~----------~----~----~----~------~----~------~--~---
>

Luc Saffre

unread,
Feb 27, 2011, 4:34:08 PM2/27/11
to sphinx-dev@googlegroups.com >> sphinx-dev
Oops, I found some more messages of this thread only later, and also the
sphinx-contrib, and the pnglily_preamble config variable. That should be
enough for my needs. Great work!

Luc

Federico Bruni

unread,
Feb 27, 2011, 5:07:47 PM2/27/11
to sphin...@googlegroups.com, Wei-Wei Guo
Il giorno dom, 27/02/2011 alle 23.34 +0200, Luc Saffre ha scritto:
> Oops, I found some more messages of this thread only later, and also
> the
> sphinx-contrib, and the pnglily_preamble config variable. That should
> be
> enough for my needs. Great work!

Version on bitbucket is not up-to-date.
Wei-Wei, are you going to push latest changes in the next future?

Look forward to seeing any emprovement.
Thanks and regards,
Federico


Reply all
Reply to author
Forward
0 new messages