Showing posts with label Josiah Oberholtzer. Show all posts
Showing posts with label Josiah Oberholtzer. Show all posts

Wednesday, June 25, 2014

Music21 v1.9 released

We are proud to release music21 v1.9.3, the latest and last release in the 1.x series.
There have been 147 commits in the two months since v1.8; here are some of the highlights:
  • MUCH faster .getContextByClass (KUDOS to Josiah Oberholtzer for this). Even if you don't use .getContextByClass in your own code, you're definitely calling something that calls it. This method figures out where the most recent key signature, time signature, clef, etc. is for any given object, finds relationships between notes in different voices, etc. For analysis of medium-sized scores (say, 3 voices, 100 measures) expect a 10-fold speedup. For larger pieces, the speedup can be over 100-fold.
  • A new stream/timespans module that makes the previous speedup possible by representing m21 Streams as AVL trees -- it's used in a few places (needs more docs), forthcoming releases will use it in a lot more places
  • Python3 support (3.3 and later). The entire test/multiprocessTest.py suite passes on Python 3. N.B. to contributors -- from now on all contributions need to pass tests on both Python 2.7 and 3.3 and later. Negative -- in the past you could have made music21 run on unsupported older systems (2.6 and sometimes 2.5); now from music21 import * will fail on pre-2.7. 2.7 has been a requirement since Music21 1.7. Fewer than 30% of Macs still in use are running Lion or earlier and thus will need to update to 2.7. This version of music21 runs about 25% faster on Python 3 than Python 2, but otherwise no new features of Python3 are used. Python 2.7 will be supported throughout the Music21 2.x cycle so no panicking -- it'll be years (if ever) before Python 3.3+ is a requirement.
  • Improvements to reductions of scores. And to analyzing voiceleading motion (some of this is backwards incompatible)
  • Better, faster, and more consistent sorting of elements in a Stream
  • Changes to the derivations module that I doubt anyone else was using anyhow...
  • Removed obsolete files.
  • Stafflines import and export from musicxml (thanks Metalmike!)
  • Complete refactoring of converter.py to make it easier for users to write their own Subconverter formats (that can eventually be put into the system)
  • Complete serialization of Streams via a new version of jsonpickle. This has big implications down the line; for now it affects...
  • Vexflow output is much improved (unless you were counting on Voices; in which case do not upgrade) using the alpha version of music21j -- Javascript reimplementation of music21's core features.
  • IPython improvements, allowing for robust and persistent communication between Javascript and Python. This will eventually (once I document it...) let you use the web browser as a UI for music21 python apps including live updating of music notation. It's too complex for most users right now, but I can attest that this will be one of the biggest perks of the 2.x development.
The usual bug fixes, documentation improvements and fixes, etc. are implemented. Thanks to MIT, the NEH, and the Seaver Institute for funding the project. (and to MIT for tenuring me in part on the basis of music21). This is the last release that Josiah Oberholtzer was lead programmer for; his considerable talents will still be on display in Abjad and many other projects he works on, and the implications of the new storage system he has developed will continue to pay off for years.

What's next?

Starting work on music21 2.0 today. That release will have some backwards incompatible changes that developers will need to deal with -- just as the path to 1.0 meant that some things that were originally thought of as good ideas were thrown out, the path to 2.0 will rely on 8 years of using music21 to fix some things that really should've been done differently from the beginning. Having just spent 2 weeks making m21 compatible with Python 3, I will give my assurance that as few incompatibilities as possible will be introduced. Most of the major changes will be on the core -- so if you've never messed with Sites, SpannerStorage, etc., you'll be fine.
  • Problems with 5 quintuplets = .99999999 of a beat will disappear. Music21 2.X will store offsets and quarterLengths internally as rational numbers (actually a custom MixedNumeral class, so that the __repr__ is nicer...). All music21 objects will gain four properties: ".offsetRational, .duration.quarterLengthRational, .offsetFloat, and .duration.quarterLengthFloat" -- in music21 2.0, .offset and .duration.quarterLength will be aliases for offsetFloat and .duration.quarterLengthFloat -- so no changes will be needed to existing code. This will give a period of time (6 months?) to switch .offset either to .offsetFloat or .offsetRational. We'll have a tool to make the switch automatically. Then at a certain point, .offset will become an alias for .offsetRational. By music21 3.0 .offset will only support Rational numbers.
  • Streams will store the position of notes, etc. in them. Right now this is all stored in the Note object itself. There are some great reasons for doing it that way, but significant speedups will take place by shifting this.
  • inPlace will be False by default for all operations on Notes, Streams, etc. -- you can plan for the migration by explicitly setting inPlace for every call now.
  • Some changes to boundary cases in .getElementsByOffset will take place -- it will not change much, but for a few users this will be crucial.
  • NamedTuples and OrderedDicts will appear in a lot of places
that's all for now, but more examples to come soon. - Myke

Friday, November 1, 2013

Music21 v.1.7 Released

The newest version of music21, v. 1.7 has been released and is available for download at https://code.google.com/p/music21/downloads/list.

In the three months since v. 1.6 some good changes and improvements have been introduced.  We focused primarily on stabilizing features that were already in music21 in some form but were too experimental to advertise widely.

A noCorpus version of music21 has also been released, the first since v.1.0.  This version can be used in pure Free/Libre projects since files that were licensed for music21 only or non-commercial use have been removed.  If you are not sure which version to download, definitely get the full version. But maintainers of Debian Linux and others can update to 1.7 noCorpus.

Music21 v 1.7 (actually 1.7.1) will be the last version to support Python 2.6. Python 2.7 is over three years old and is supported by other flavors of Python including Jython (which skipped 2.6), PyPy, IronPython and is an easy upgrade for Python on Windows.  Mac users have had 2.7 since Mountain Lion and we're happy to report that with Mavericks being free and supporting systems that can run Snow Leopard, we're happy to be able to use this opportunity to take advantage of the latest features and start a roadmap to supporting Python 3.3 as well.  This is also the last release to use SVN.  We are moving to GitHub.  Updates soon.

The most important improvement for users is a much improved system of metadata searching (thanks to Josiah Oberholtzer). See:

http://web.mit.edu/music21/doc/usersGuide/usersGuide_11_corpusSearching.html

for more details.  LocalCorpus objects are elevated to equal status as the Core corpus so you can now build searchable indexes on any data you have and find the file you want much faster.  Try corpus.search('haydn') and read the docs above to see what's possible.

Among the other 150+ changes since 1.6 include:

  • Chord.inversion(2) will take a root position chord and put it in second inversion. (this is a change of behavior from before, where .inversion(2) would specify that the chord was in second inversion and override default inversion reporting (for things like Jazz 6 chords). To get the old behavior, use .inversion(2, transposeOnSet=False)
  • Fixes for abc parsing (N.B. the next version will rename the "abc" module to "abcNotation" to avoid the occasional name clash with the python AbstractBaseClass (abc) module).
  • Stream.getElementsByOffset(4.0) can now find a zero-length object at 4.0 -- bug fix.
  • Many modules are now packages (Stream, for instance).  This should not affect your code.  Existing packages with X/base.py can now find their files in X/__init__.py.  Again, this should not affect your code.
  • Page break support in Lilypond.
  • MIDI translate works better with instruments (thanks to Christopher Antilla)
  • Improvements to Braille Music Code output (thanks to Mario Lang; more to come)
  • Bug fixes in measure copying involving pivot chords and secondary dominants in RomanText
  • Roman numerals for VII, VI, viio/vii, vi/vio in minor are made more robust.  It6, Ger65, Fr43, are now supported.
  • Many many many bug fixes.  Thanks to community help!
Thanks as always to the NEH, Digging into Data program, the Seaver Institute, and MIT for their support of the project.