Re: midi2ly: makeshift patch

2007-04-11 Thread yota moteuchi

On 4/9/07, Graham Percival <[EMAIL PROTECTED]> wrote:


Alexander Hanysz wrote:
> Below is a patch for what on my system is the file
> /usr/local/lilypond/usr/bin/midi2ly (I'm using version 2.10.20).
>
> Fixed (?): the --key command line argument is recognised; key signatures
> and time signatures now appear correctly; rests are visible.

Do you have a test file for this?  If I can easily verify that this
works, I'll commit these changes.

> Not tested: changes of key or time within a piece.
>
> To do: correct notation for syncopated notes and for rests that span
> more than one bar; the --output argument doesn't seem to work.
>
> Unfortunately I won't have time to continue working on this.  (I'm up
> against a deadline, so I have to go back to using Finale to finish my
> arrangement :-(  )  But someone who actually knows what they're doing
> shouldn't find it too hard to fix this up.

Unfortunately the main developers are very busy at the moment; we don't
have time to fix up patches.  If any users here know python and are
interested in helping, we welcome any assistance; otherwise this work
will go to waste.

Speaking from experience, python is an easy language to learn.  If any
users here are interested in helping out but don't know any programming
languages, python (and midi2ly) would be a great place to start.

Cheers,
- Graham



I'm also a bit time limited, but I have some knoledge in python. Could one
of you send me the patched version and a description of the buggy parts. I
could be able to fix it enough to insert it into the code
...well I hope so :)

Yota
___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: midi2ly: makeshift patch

2007-04-09 Thread Graham Percival

Alexander Hanysz wrote:
Below is a patch for what on my system is the file 
/usr/local/lilypond/usr/bin/midi2ly (I'm using version 2.10.20).


Fixed (?): the --key command line argument is recognised; key signatures 
and time signatures now appear correctly; rests are visible.


Do you have a test file for this?  If I can easily verify that this 
works, I'll commit these changes.



Not tested: changes of key or time within a piece.

To do: correct notation for syncopated notes and for rests that span 
more than one bar; the --output argument doesn't seem to work.


Unfortunately I won't have time to continue working on this.  (I'm up 
against a deadline, so I have to go back to using Finale to finish my 
arrangement :-(  )  But someone who actually knows what they're doing 
shouldn't find it too hard to fix this up.


Unfortunately the main developers are very busy at the moment; we don't 
have time to fix up patches.  If any users here know python and are 
interested in helping, we welcome any assistance; otherwise this work 
will go to waste.


Speaking from experience, python is an easy language to learn.  If any 
users here are interested in helping out but don't know any programming 
languages, python (and midi2ly) would be a great place to start.


Cheers,
- Graham


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


midi2ly: makeshift patch

2007-03-31 Thread Alexander Hanysz
It's already been mentioned that midi2ly is broken, so I thought I'd 
have a go at fixing it.  It's my first encounter with python, so it's 
been an amusing experience for me, and it's still a long way off working 
perfectly, but it's better than nothing.


Below is a patch for what on my system is the file 
/usr/local/lilypond/usr/bin/midi2ly (I'm using version 2.10.20).


Fixed (?): the --key command line argument is recognised; key signatures 
and time signatures now appear correctly; rests are visible.


Not tested: changes of key or time within a piece.

To do: correct notation for syncopated notes and for rests that span 
more than one bar; the --output argument doesn't seem to work.


Unfortunately I won't have time to continue working on this.  (I'm up 
against a deadline, so I have to go back to using Finale to finish my 
arrangement :-(  )  But someone who actually knows what they're doing 
shouldn't find it too hard to fix this up.  I hope that later in the 
year I'll be able to switch over to lilypond for all my typesetting needs.


Alexander Hanysz

---cut here---

--- /usr/local/lilypond/usr/bin/midi2ly 2007-02-25 10:33:03.0 +1030
+++ /home/alex/bin/midi2ly.py   2007-04-01 14:39:04.0 +0930
@@ -667,10 +667,12 @@


 def dump_channel (thread, skip):
-global reference_note, time
+global reference_note
+#global time: moved to convert_midi (in_file, out_file)
+
+#global_options.key = Key (0, 0, 0) # not needed?
+

-global_options.key = Key (0, 0, 0)
-time = Time (4, 4)
 # urg LilyPond doesn't start at c4, but
 # remembers from previous tracks!
 # reference_note = Note (clocks_per_4, 4*12, 0)
@@ -745,7 +747,7 @@
 item = thread_first_item (channels[i])

 if item and item.__class__ == Note:
-skip = 's'
+skip = 'r' # changed from skip = 's' -- want printed rests
 s = s + '%s = ' % (track + channel)
 if not global_options.absolute_pitches:
 s = s + '\\relative c '
@@ -764,6 +766,9 @@
 if clef.type != 2:
 s = s + clef.dump () + '\n'

+s = s + time.dump ()  # added
+s = s + (global_options.key).dump () # added
+
 for i in range (len (channels)):
 channel = channel_name (i)
 item = thread_first_item (channels[i])
@@ -813,11 +818,13 @@


 def convert_midi (in_file, out_file):
-global clocks_per_1, clocks_per_4, key
+global clocks_per_1, clocks_per_4, key, time
 global start_quant_clocks
 global  duration_quant_clocks
 global allowed_tuplet_clocks

+time = Time (4, 4) # moved here from dump_channel
+
 str = open (in_file).read ()
 midi_dump = midi.parse (str)

@@ -836,7 +843,7 @@

 tracks = []
 for t in midi_dump[1]:
-global_options.key = Key (0, 0, 0)
+# global_options.key = Key (0, 0, 0) # not needed?
 tracks.append (split_track (t))

 tag = '%% Lily was here -- automatically converted by %s from %s' 
% ( program_name, in_file)



___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user