I'd be interested in taking a look at your code, It should help get my brain working. I'd also be interested in feedback from you if your interested to critique my approach.

Nathanael

>About ten years ago (on Atari/MiNT) I wrote a C program similar to this, but
>for baroque lute tabulature... I wanted it to help me transform any midifile
>I was interested in, be it classical orchestral or chamber works, piano works
>or pieces for classical guitar, in a semi-automatic way, to Wayne Cripp's
>lutetab code, and it worked out surprisingly good, given that I was a
>lousy DIY hacker ;) (I don't really code anymore).
>
>I didn't care much about 2) and 3) but for 1) I came up with an algorithm like
>this:
> - determine the string on which the pitch can be played at the lowest fret
>  possible
> - check if this string is used already, and if yes move this note to the next
>  (lower) string
>
>For notes lower than the instrument range (13 course lute goes down to A, a 5th
>lower than guitar) I chose to just place a comment in the tab output, so that I
>would be able to decide afterwards what to do with that note (transpose up an
>octave, skip it, whatever).
>
>Since it's been a long time now I can't remember how I dealt with files
>containing more than one track, but I somehow managed to merge them into a
>single tabulature, I have for example produced nice tabulatures of the
>accompaniment of the first three movements of Pergolesi's Stabat Mater.
>For these of course I had to prepare the midifiles, remove the voice tracks
>and transpose to a key suitable to the lute.
>
>Other problems I've encountered and I'm not sure if or how I solved them:
> - the bar/beat counting got screwed up sometimes, especially with grace notes
> - of course, I had to remove double notes when boiling down ensemble works
> - there are different lute tunings, I only dealt with standard baroque
>  d-minor tuning
> - on the lute, the diatonic basses (lower than the 6th course) are tuned to
>  the key of the piece
>
>The thing is based on the ancient midifile(3) lib by Tim Thompson et al. which
>is a little gem IMHO. The library parses the midifile, all you have to do is
>to write a few callback functions for the events you're interested in. Some
>example code is in the archive, and it took me just a few days to come up with
>something useful.
>
>I never seriously thought about releasing it, even after I compared it's
>output's quality to what Django can do (an impressive M$ tabulature editor,
>mainly for historic fretted instruments, the demo from
>http://musickshandmade.com/lute/pages/django runs quite well in wine) and
>found that I was doing pretty well. :)
>
>I'm sure there are stupid things in there and it's not at all in a releasable
>state, but if you are interested I'll share the code...
>