Thursday, July 26, 2007

More formal midsummer overview

(Current code. Requires the puri and cxml packages in addition to Gsharp's other dependencies.)

As it is the midpoint of the summer, it seems an appropriate time to take a step back and examine my progress so far. Besides basic sequences of notes, the following features are now fully supported in both import and export, except where noted:

  • Accidentals
  • Key signatures
  • Chords/clusters
  • Multiple staves
  • Measures (export only)

The last feature tackled prior to this report was support for multiple staves. Several more basic features demand attention: clefs, and perhaps most prominently notes that vary by duration are good examples (right now my work assumes that everything is a whole note). But a certain group of features are more "basic" in a completely different way: they are at the root of the structure of the musical data as represented in Gsharp and MusicXML. These are best implemented sooner than later because doing so touches a great deal of other code already written; this is partly because in order to do anything, including the simple "hello world" example with which this project began, code had to be written to supply constant versions of these structures. Early versions of the code always created one staff in one layer with one measure. Working on these features has also uncovered weaknesses in my Lisp programming technique and overall design; I discovered, for example, that I was overzealous in my use of generic functions and this was hindering my progress.

I have had my previous programming experience hinder me here and there as well. For example, I recently had an occasion where I was passing a variable down as a function parameter through several layers of functions, refusing to make it a global variable simply because it had been drilled into my head that such behavior was acceptable only on very specific occasions, and this was clearly not one of them. Christophe kindly reminded me that I could use real honest-to-goodness dynamic scoping and that my choices weren't limited to 2 kinds of ugliness. Overall however, I am not under the impression that my previous experience has been too much of a burden.

My biggest obstacle continues to be a problem I have, over the years, realized occurs in all kinds of engineering projects (for me anyhow). I simply try to implement five things at once instead of focusing my attention at one specific task at a time. This happened right at the beginning of the project, when implementing the initial, "hello world" parser. Only after a few days did I realize that i was trying to parse multiple staves, multiple voices and multiple measures. I think this might present more of a problem in this context because being fairly new to Lisp means I am less able to picture the general structure of the program in my head before I write it.

The following features remain to be implemented:

  • Clefs (export completed as of this writing)
  • Notes of varying durations
  • Multiple voices/MusicXML motion declarations
  • Rests
  • Ties
  • Lyrics
  • Menu entries for export and import

"Notes of varying durations" will also entail beams/flags and dots. "MusicXML motion declarations" refers to the "forward" and "backup" elements, which are used in MusicXML "to coordinate multiple voices in one part" -- the current implementation for more than one stave does not correctly deal with concurrent clusters on those staves. This feature is dependent on notes of varying durations. Given my current rate of progress, I see no reason why these features should not be completed by the end of the summer.

No comments: