Music21 Versions Save

music21 is a Toolkit for Computational Musicology

v5.0.3a1

6 years ago

Releasing alpha 1 of v.5 of music21 quite early, because it 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: https://github.com/cuthbertLab/music21-demos -- 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

pip install --upgrade music21==5.0.3a1

v4.1.0

6 years ago

Music21 v. 4 is released! 273 commits mean a lot of new features! See:

https://music21-mit.blogspot.com/2017/08/music21-v4-released-410.html

Download here or run

pip3 install --upgrade music21

to get the latest version

v4.0.6-beta

6 years ago

Lots of work towards the v4 release in the past 18 days, among the changes since 4.0.6:

documentation has been moved out of the music21 directory into the root directory -- it is no longer installed with music21 from pip -- this change was necessitated by the move to retina quality graphics, but reduces the installation size from 90MB to 15MB for the full corpus version and 6MB for the no-corpus version.

But docs are still extremely important as witnessed by the 3 new user's guide chapters and removal of some obsolete docs. And all docs pass a new nbval test. nbval is now required to build docs.

Chord.add (was append()) and Chord.remove() allow for direct manipulation of bugs.

Improvements to parallel processing in music21.

Ottava spanners now come in two types, transposing and non-transposing -- reflecting whether the pitches under the spanner already reflect the transposition (non-transposing) or not.

Many improvements to spanners and RomanNumerals.

.exe files are no longer generated -- they were rarely used and pip is a better choice for Windows users now.

v4.0.4-beta

6 years ago

v4.0.4 beta represents the first preview release of the new music21 v. 4 system. As with all new "X" release names, v.4 has backward incompatible behaviors that I think are worth it for the great new features. The release is stable enough for general use and almost might be a release candidate.

among the 157 commits since v.3.1:

Major new features:

  • Graphing rewrite!

.plot() and Graphing has always been one of the most powerful parts of music21 since long before v.1.0 (mad props, Christopher Ariza!) but it's also been one of the most daunting aspects of using music21. It shouldn't be any more. The code has gone through a major rewrite to improve the simplicity of doing easy things and the power when doing difficult things. The easy things are documented in Chapter 22 and the hard things in Chapter 44.

  • Style!

the all new style module and style.Style object handles aspects of a note or other object's visual display that are not (usually) semantic. This class has allowed a major increase in the ability to properly preserve MusicXML visual formatting on input and export.

Style objects are created only when needed, so el.hasStyleInformation() allows for checking for the presence of a .style object without creating one.

(To be documented more soon)

  • Major rewrite of TinyNotation allows for easy extensibility.

Documented in the User's Guide! Check it out!

  • Always improving docs

The User's Guide goes up to chapter 24 now, with major new examples in Chapter 20 along with rewritten chapters on keys, time signatures, sorting, and so on and so on. Plus all examples are now Retina quality for viewing fine details of scores.

Other new features

  • much better metadata processing in musicxml, humdrum, and braille
  • improved braille translation (tuplets) -- thanks Bo-Chen
  • better beaming, meter, and tuplets in ABC
  • output directly to PDF if MuseScore is installed.
  • Nested Tuplets! including in MusicXML.
  • Non-traditional key signatures
  • New works by Clara Schumann in the corpus.
  • stream.iterators.OffsetIterator() -- iterate groups of objects by offset.
  • improvements to analysis.discrete
  • demos/build_melody shows how to build MidiFile directly (thanks PeterMitrano!)
  • corpus paths are now searchable in corpus.search()
  • matplotlib and musescore graphics in Jupyter notebook are now retina quality.

Others, including bugs squashed:

  • Warning on Python 2 that music21 v. 4 is the last version to support Py 2.
  • ABC key signature and mode error fixed.
  • AudioSearch bugs fixed (thanks jjrob13)
  • Chord.normalOrderString (thanks emzhang)
  • Removed lots of old crutches including the "analysisData" on Stream, Note.editorial, and others. Style fixes most of this.
  • fix to Bach BWV 386 (thanks alexcoplan)
  • Note.pitches returns a tuple not list, just like Chord.pitches
  • Converter can deal with some wrong file extensions now.
  • Instrument reprs are fixed
  • configure finds many more notation programs.
  • ties are imported better between elements in and out of voices in musicxml
  • configure works on macOS when user directory contains spaces.
  • Bugs in ending and restarting a recursiveIterator fixed.
  • doc errors fixed (thanks Andrew Sanchez)

Deprecations and deprecated elements removed

  • (this list does not contain changes to the alpha/ directory which can change at any time)
  • Note.ps, and Note.accidental, Note.pitchClass, Note.pitchClassString, Note.diatonicNoteNum, and Note.microtone are all deprecated. Use Note.pitch.ps, etc. instead.
  • Chord.normalForm is deprecated because it gave the wrong answer. use normalOrder instead; same with normalFormString
  • SpannerBundle.list is deprecated; use list(SpannerBundle) instead
  • with the advent of .style, el.color is deprecated, use el.style.color instead
  • Stream.stream() is deprecated -- now that the transition to iterators is done, there should be no need for this.
  • REMOVED stream.getOffsetByElement; use s.elementOffset(el) instead.
  • REMOVED stream.haveBeamsBeenMade; use stream.streamStatus.haveBeamsBeenMade
  • REMOVED stream.makeTupletBrackets(); use stream.makeNotation.makeTupletBrackets(s)
  • REMOVED stream.realizeOrnaments; use stream.makeNotation.realizeOrnaments(s)
  • nbconvert is no longer packaged with music21

v3.1.0

7 years ago

Version 3 of music21 is here! This is the first major release in 11 months, with nearly 600 commits since the last version. As a new major version, there are both huge new features as well as significant (often backwards incompatible) changes.

For complete details see: http://music21-mit.blogspot.com/2016/08/music21-v-3-released-310.html

v3.0.6-beta

7 years ago

The beta/release-candidate for v3 of music21 -- a toolkit for computer-aided musicology, has been released! We are very close to a v3 final, with many great improvements.

For details, see: https://music21-mit.blogspot.com/2016/08/music21-v-3-beta-306-released.html

v3.0.3-alpha

8 years ago

The first release of the music21 v.3 system. Major changes include the creation of "StreamIterator" classes that greatly reduce the number of Streams created. Full release notes are available on the music21 list. Not backwards compatible.

v.2.2.1

8 years ago

This maintenance release of music21 fixes several errors in MusicXML input and output and marks some functions or properties (such as Music21Object.isGrace) as deprecated for 3.0. It mainly fixes under-the-hood errors. It also adds compatibility with matplotlib 1.5.

Major changes are going in the music21 3.0 track.

v.2.1.2

8 years ago

Fixes some small errors throughout that were uncaught in v.2.1.0 release due to one of the errors breaking the test system, and one larger error in stream.replace() which is main reason for the quick update.

Adds some features that were originally slated for 2.3, but which were ready and thus are easier to add now than to back out and put out later, including:

  1. improvements to multi-measure rest handling on import/export musicxml and representing in the note.Rest() object.
  2. rest positions off center line are now imported and exported to musicxml (note: musicxml records rest position as a pitch irrespective of clef. Music21 records offset from center line)
  3. open File objects and file-like objects (BytesIO and StringIO) can be passed in place of file names in many cases.
  4. stream.chordify(addPartIdAsGroup=True, consolidatePitches=True) now works properly if a single pitch appears in multiple parts.
  5. improvements to layout.py
  6. like lists, tuples, etc. -- bool(Stream) now returns True if there's at least one object in it, and False if it is empty. Similarly for StreamIterator objects
  7. speed improvements throughout many stream functions by replacingif len(stream.getX()) > 0: with if stream.iter.getX() which will return True as soon as the first item is found.
  8. alpha version of having music21 automatically load certain %magic functions under IPython/Jupyter Notebook. Will announce this further when I'm sure it works.
  9. Added documentation warnings about using .elements -- there's almost no need to do so; will work on potentially deprecating it soon.

v2.1.0

8 years ago

The long-awaited (at least by me) version 2 of music21 is released! This is the first version of the v.2 release to be out of beta and stable enough for general use by everyone.

The first non-beta release of music21 since v. 1.9.3 (June 2014) gives a ton of new features and lots of new speed. But being a major release change number, it also has some changes that every programmer using the system needs to be aware of. The release notes on GitHub gives all the details, but here are the highlights since 1.9:

Changed and Added features

  • Duration and Offset now use Fractions when necessary for exact representation of tuplets. Many, many errors from rounding are gone. For now, you can use Duration.quarterLengthFloat and offsetFloat to get the old behavior, but float(Duration.quarterLength) and float(offset) are better.
  • Converters support easy to install custom sub converters. MEI is now supported (thanks to McGill university)
  • Python 2.6 is not supported. Python 3.4 is highly recommended; 2.7, 3.3, and 3.5 also work.
  • Loading cached streams is extremely fast. All streams are automatically cached when loaded from disk.
  • Sorting is much more consistent and faster
  • MusicXML parsing and showing have been rewritten to use cElementTree and many new features.
  • Stream's internal mechanisms have been hugely rearranged. Now offsets are stored inside Streams instead of inside Notes, etc., making lots of things faster and more reliable.
  • Streams support filters on iteration using the .iter property and the recurse() method. These are big changes for speed and reliability.
  • Namedtuples replace anonymous tuples in many places
  • Music21 is available under the BSD license.
  • Musedata files are no longer available in the corpus. However, new files in MusicXML format have replaced several of them.
  • Complete rewrite of TinyNotation making it much easier to subclass for your needs.
  • If you have MuseScore 2, try sc.show('musicxml.png') to get a beautifully rendered musicxml file. Or use .pdf to get something ready to print. Thanks Nicholas, Thomas, and Walter!
  • Builds are automatically tested for errors and documentation coverage.
  • Experimental modules moved to the alpha sub package. demos reorganized.
  • Lots of documentation changes!
  • Obscure and almost never used (or actually never used) methods and attributes have been removed.
  • Did I mention how much better the documentation is getting?

In case anyone is keeping track, since v.1.0 (June 2012), here are the:

Biggest changes between 1.0 and 1.9

  • Store complete Streams via FreezeThaw
  • Output to Vexflow and music21j
  • Converters have been moved into packages.
  • It takes 1/3 the time to do most operations, and 1/4 the time to start up.
  • Capella supported. ABC imports almost everything. Humdrum supports multiple voices. Chords have a better root() algorithm
  • Many, many new corpus pieces.
  • Layout support.
  • Python 3 supported, and now recommended.
  • Timespans make .getContextByClass at least an order of magnitude faster, letting music21 handle huge scores.
  • Derivations reduce the number of Streams to keep track of.

Oh, and I did more than patch bugs in the last week:

Release notes since 2.0.11

  • Streams use .iter and .recurse() in TONS of functions, making many a lot faster, a few a bit slower, but all cleaner to debug and safer.

  • Deprecated items now return a deprecation warning.

  • Duration objects now have a .client which can inform the Note of changes to it.

  • .classes searches are way faster. Returns tuple.

  • deepcopy is about 30% faster.

  • common is split into a directory of related functions. Now worth looking through.

  • all corpus files, including small .abc files with non-standard additions, now parse. A complete corpus.search().parse() should be possible without any try: statements.

  • several bugs in musicxml processing (mainly related to the handling of expressions, noteheads, etc., on chords) have been fixed. Also Finale's <transpose> tag is supported.

  • code is much more "lint-free" catching many subtle bugs.

  • audioSearch is cleaned up, with beta-type code moved to demos.

  • Documentation much improved including three new User's Guide sections, and (thanks to bagratte) fixes for UTF-8 errors.

  • io.open replaces codecs.open for better non-Western script handling.

  • .egg files are no longer distributed. I'll work on getting .whl (wheel) files soon, but for now use .tar.gz. PyPi no longer supports .egg, so there's no reason for them.

    incompatible changes

  • .fullyQualifiedClasses is GONE. No one used it. Instead a new .classSet replaces it for rapid class searching.

  • sites.Sites and sites.SiteRef are no longer imported into base by default.

  • documentation modules reorganized, with better examples.

  • stream.core moves several core modules out of the stream module.

  • Volume.parent renamed Volume.client to match Derivation and Duration

  • .components on Duration now returns a tuple.

What's Next?

Today also announces the first commit of music21 3.0 -- for the first time, I'm going to try to do something daring: keep bug fixes and some backwards compatible changes in the 2.1 (2.2, etc.) branch, but go forward with bigger changes in a 3.0-alpha branch. Some things that you might expect to happen:

  • All deprecated functions will be gone in 3.0; like immediately; like I'm deleting them as I type.
  • Lots of things that currently return a Stream will instead be iterators over Streams. These include: .getElementsByClass(), getElementsByOffset() -- the fact that so many streams get created is one of the biggest headaches and reasons why the system gets slow. You can prepare for the change by examining your usage of these functions and asking yourself, "Am I actually using this as a Stream? Or just as a bunch of objects to iterate over in a for loop or to count using len()"? If the latter, you're fine. If the former, go ahead and add .stream() after it, for instance filteredStream = s.getElementsByClass("TimeSignature").stream(). The last .stream() call does NOTHING right now, but it will ensure that your code works exactly the same after the change happens. If you want to use the new features (even in 2.1) add .iter between s and .getElementsByClass() (but leave off the .stream(). You'll find that life will be going a lot lot lot faster.
  • I'm going to make a second attempt to use TimeSpans as a general storage engine for Streams. These are the super fast representations of Streams that Josiah Oberholtzer made, that speed up working with large streams by 10-100x. But for very small streams (such as one measure of a Chorale), they are much slower than the current Streams. Now that all the core mechanisms are factored out of Stream into StreamCore, I can play much more easily with switching in any out the backend functions. Using the lessons of Python's TimSort, I'll probably have the TimeSpan core kick in immediately when there are more than 64 elements in a Stream; it should be seamless except for a tiny delay when the 65th element is added (like shifting gears in a car).
  • I may make Python 3.4 a requirement. We'll see... I'm sick of coding for Python 2. Python 3 is much more fun from the coder's perspective.

Thanks everyone for great support! -- Myke