lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: LilyPond -> Midi? [and: Python scripts in Windows native 2.6 version


From: John Mandereau
Subject: Re: LilyPond -> Midi? [and: Python scripts in Windows native 2.6 version]
Date: Thu, 18 Aug 2005 16:10:17 +0200

Aaron Morse wrote: 
> On 8/17/05, John Mandereau <address@hidden> wrote:
> > Please always tell which platform and which LilyPond version you
> use! 
> Sorry, I completely forgot. I believe I have LilyPond 2.6.3 for
> Windows on a system running Windows XP Home (Dell Dimension 2400, 256
> MB RAM, etc.)

This is important information: goodies like midi2ly, convert-ly, and
other converters are Python scripts, so you have to have Python
installed to run them.

I suppose of course that you use 2.6.3 Windows native version (it's
possible to compile it on Cygwin...)

You can get Python 2.4.1 for Windows at http://python.org.


> > > My second question is what syntax I would use running the midi2ly if I
> > > have a midi file I want to transfer to a lilypond file. I didn't find
> > > anything about this in the documentation. . .
> > But it is in the documentation: just see
> > http://lilypond.org/doc/v2.6/Documentation/user/out-www/lilypond/Invoking-midi2ly.html
> > 

For more convenient use, add
<LilyPond installation directory>\usr\bin\
to your PATH, and add extensions .PY and .PYC in PATHEXT;
you can do this in Control Panel -> System -> Advanced
-> Environment variables -> System variables

Open a command line (cmd32.exe) and run:

midi2ly your-midi-file.mid

I have tried this... and :-( got this error message:

Traceback (most recent call last):
  File "/usr/bin/midi2ly", line 42, in ?
    import midi
ImportError: No module named midi

It's a bug: on my Linux system there is exactly the same.
Here's a general fix, which I'll submit to bug-lilypond.
Open midi2ly.py and edit these lines:

libdir = '/usr/lib/lilypond/2.6.3'
if not os.path.isdir (libdir):
       libdir = '/usr/lib/lilypond/2.6.3'
sys.path.insert (0, os.path.join (libdir, 'python'))

replace 'lib' with 'share' and save the file.

The last problem is, it won't work on Win XP because there is no python
directory in usr/share/lilypond/2.6.3... and "native Windows" Python may
(?) rather understand Windows-style paths. But you can still follow
these tips: you'll be able then to run convert-ly, and maybe other
Python scripts.

There are here potential improvements to Windows native LilyPond:
- Python could be mentioned as a dependency
- The installation program could set the environments variables like I
explained above
- Python libs (in usr/share/lilypond/2.6.3) could be compiled into
Windows native version too
If it was done, the converters (and even maybe lilypond-book? for those
who have TeX installed) would work as explained in the documentation :-)

This can certainly be sponsored. (but don't ask me, I'm no more on Windows)

Please keep this discussion on the list (Cc all messages to
address@hidden), it may be interesting for other users.

I have forgotten something in your .ly example below: if you want both
PDF and MIDI output, you must have both \layout {} and \midi {} blocks
in the \score block: 
> > >
> > > \include "horn.ly"
> > > \include "trumpet.ly"
> > > \include "drums.ly"
> > > \include "bass-tbone.ly"
> > > \header {
> > >       title = "Ea"
> > >       instrument = "Trumpet in C, Horn in F, Bass Trombone, Percussion"
> > >       composer = "Aaron Morse"
> > > }
> > >
> > >
> > \score {
> > > <<
> > > \new Staff \trumpet
> > > \new Staff \horn
> > > \new Staff \tbone
> > > \new Staff \percussion

\layout {}

> > \midi {}
> > }
> > 
> > 
> > > How would I specify for it to create a midi sound file of the piece?
> > It is explained:
> > see 
> > http://lilypond.org/doc/v2.6/Documentation/user/out-www/lilypond/Creating-MIDI-files.html
> > and see above how I have modified your input. You may add a tempo
> > specification in the \midi block.
> > 

-- 
John Mandereau <address@hidden>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]