Wednesday, January 3, 2018

music21 v.5 alpha 2 released

The second alpha release of music21 version 5 (Python 3.4+ only) has been released.  There have been 47 new commits since alpha 1 (more on that below) mostly of a maintenance sort.  V5 is still pre-release code, and the syntax is still in flux until the main release next summer, but it is well-tested and good for most hobbyist coding.

Here are the main changes since alpha 1:
  • Better parallel processing system (esp. in terms of docs)
  • Pitches are 30% faster to create, notes are 15% faster.  You do create notes, don't you? :-)
  • Better musicxml support: volume.  Improvements to transposition, glissando, barlines
  • Corpus: added works by Amy Beach, Schubert (Lindenbaum), fixed missing Bach Chorales (thanks Dr. Schmidt!) and error in Haydn op. 1 no. 1 movement 1(thanks Joshua Ballance)
  • Scales, IntervalNetwork: faster and better documented.
  • NeoRiemannian analysis greatly improved (thanks Mark Gotham!)
  • voiceLeading.VoiceLeadingQuartet improved.  compatibility change: improperResolution renamed to isProperResolution and improved.  Former title implied that False meant it was proper; now the title reflects the output.
  • Instrument objects now have their MusicXML v.3 sound tags attached (thanks Luke P.!)
  • Bugs fixed: chords not in voices in measures with voices were not found in some routines. Instrument objects without midiProgram explicitly set get a program on MIDI output.  MIDI no longer inserts a rest at the beginning (thanks KKONZ).  Chord.normalOrder fixed (thanks luiselroquero), bugs in Capella parsing. Bugs related to Apple File System High Sierra not sorting files by default.

I neglected to post on this forum the announcement of music21 v.5 alpha 1, so the many great improvements there are listed below, with a new installation link:

Alpha 1 of v.5 of music21 includes an amazingly faster improved version of Chordify (thanks in large part to work by Josiah Wolf Oberholtzer)
music21 v.5 is PYTHON 3 ONLY
Do not upgrade to this version if you are using Python 2.7 (or better still, upgrade yourself to Python 3.6 instead). It runs on Python 3.4-3.6 only.
This is alpha code -- I am still formulating the changes for m21 version 5. Some things that have disappeared since v.4 may reappear, but some things that are currently here may be gone or significantly changed by v5 release. YMMV.
Other big changes:
  • Python 3 only. Yes, I said that but I'm saying it again. This change has made developing much faster and a lot more fun. Also it's made music21 more powerful and faster.
  • Chordify moves from O(n^2) to O(n) time -- Chordify on large scores works great now.
  • MusicXML roundtrip now preserves much about appearance, style, metadata, etc. -- you can now load a musicxml file into music21 and back into your software and 90% of the time you'll get visually the same result as the original software. Finale roundtrip is especially good!
  • Corpora searching is much better and much faster. Metadata is stored in pickle format.
  • Feature Extraction runs multicore by default. Together with the average of 10x faster chordify, feature extraction on large datasets on multicore systems is now very strong.
  • Many routines that used to return string filepaths now return pathlib.Path objects.
  • Almost all deprecated functions are removed.
  • Many keyword functions are now keyword only, so no worries about passing in "inPlace" accidentally.
  • parsing of Volpiano (Gregorian chant notation) added.
  • RehearsalMark is added (and in musicxml also).
  • Empty spaces in MusicXML measures are converted to hidden rests, to avoid gapped streams.
  • Pitches in chords on musicxml import are always sorted from lowest to highest.
  • analysis.transposition -- searches pitch lists for number of distinct transpositions (thanks Mark Gotham)
  • Copyright and other metadata is preserved in many formats on import. This is just being a good neighbor.
  • Demos and most alpha code has been moved to a new separate repository: -- they will be updated much less frequently. This will also make code development faster. Thanks to all who have contributed to music21's development. We'll be able to get more demos into the codebase by not needing to update them at every moment.
The remarkable work over less than a month has been largely aided by dropping the Python 2 code dependencies, so while upgrading to Python 3.6 might cause some grumbling, my ability to forge ahead quickly I hope will more than make up for it!
This is alpha code. It won't install by default on pip. Use
pip3 install --upgrade music21==5.0.5a2