... I'm working on developing true chromatic transposition as built-in
functionality for Lilypond.
The current fruit of this work is contained in the attached file
naturalizeMusicModern.ly which defines a flexible Scheme function that
can be used to naturalize pitches according to various different rules.
As a first step to building this into core Lilypond, the obvious thing
to do seems to be to move the Scheme functions into a .scm file in the
scm/ directory of the Lilypond source code. This I've done (see the
attached file naturalize.scm) and I've written another Lilypond demo to
make use of this (naturalizeMusicIntegrated.ly).
Lilypond appears to 'recognize' the existence of the new .scm file since
issuing a 'make' command rebuilds various stuff after that file is
edited. However, when running the newly-built Lilypond on
naturalizeMusicIntegrated.ly I get an error,
GNU LilyPond 2.13.28
Parsing...naturalizeMusicIntegrated.ly:5:4: In expression
(ly:naturalize m (ly:naturalize-limit >= 1) ...):
naturalizeMusicIntegrated.ly:5:4: Unbound variable: ly:naturalize
(... note that my native installed Lilypond is the 2.12.x version that
comes built in with Ubuntu, so it's not simply that I'm running the
So, it looks like the functions in my new .scm file are not visible to
the Lilypond interpreter. How do I make them so? :-)
On 21 July 2010 22:00, Joseph Wakeling <[hidden email]> wrote:
> On 07/21/2010 10:04 PM, Neil Puttock wrote:
>> The .scm file has to be loaded into the `lily' module; see the
>> definition of `init-scheme-files', which lists all the files to be
> Great, thanks -- all working now.
> Style query -- is the naming of the functions as ly:naturalize etc.
> appropriate? Or should I kill the ly: prefix?
Kill. It should only be used for functions exported from C++.
> I have a few technical queries too, but I'm going to try and figure them
> out myself first (they're Scheme-y rather than Lilypond-y...).
I've just had a quick glance at naturalize.scm, and one thing jumps out:
(/ 1 2)
is more conveniently written as a rational,
though it's probably easier to see what's going on in the file if you
use the predefined constants for alterations: