Music21

Latest version: v9.1.0

Safety actively analyzes 630026 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 7 of 8

2.0

1. Added bug catching for MusicXML that gives the shape of the clef ('G', 'F') but no line -- uses sensible defaults. And many other cases in MusicXML where an attribute is empty (as one musicxml writer is now producing)

As always thanks to MIT, the Seaver Institute, and the NEH for funding early development of `music21`.

2.0.0

Not secure
We're happy to announce that the first public alpha of music21 v.2 has been released!

Version 2 is the first version of music21 since v.1 to make substantial changes in the code base that introduce backwards incompatibilities in order to make going forward faster and smoother. It doesn't change anything super fundamental à la Python 3's print function, so most code should still run fine, but definitely test in a separate environment before upgrading on any code you have that needs to run without problems. The system is still changing and more backward-incompatible changes could be included until v.2.1.

We have had 420 commits since the last release, so there is a lot that is new!

Substantial changes include:
- Offsets and quarterLengths are now stored internally as Fractions if they cannot be exactly represented as floating point numbers. A lot of work went into making this conversion extremely fast; you probably won't ever notice the speed difference, but you can now be sure that seven septuplets will add up to exactly a half note. For instance:


>>> n = note.Note()
>>> n.duration.appendTuplet(duration.Tuplet(3,2))
>>> n.fullName
'C in octave 4 Quarter Triplet (2/3 QL) Note'
>>> n.quarterLength
Fraction(2, 3)
>>> n.quarterLengthFloat if you need it...
0.6666666666666666

- Converter structure has been overhauled for more easily adding new converters in the future. If you've wanted to write a converter or already have one for a format not supported but have been daunted by how to include it in music21 now is a great time to do it. Speaking of which...
- MEI format is supported for import (thanks to Chris Antila and the ELVIS team at McGill university for this great enhancement)
- Python 2.6 is no longer supported. All tests and demos pass and run on Python 2.7, 3.3, and 3.4. (3.2 and older are not supported)
- FreezeThaw on Streams works much better and caching loaded scores works great (some of this was included in 1.9, so definitely upgrade at least to that.
- Much improved Vexflow output using music21j, Javascript/Vexflow rendering engine. Was in 1.9, but improved here.
- Lots of places that used to return anonymous tuples, now return namedtuples for more easily understanding what the return values mean.
- Integrated Travis-CI testing and Coverage tests will keep many more bugs out of music21 in the future.
- Many small problems with Sorting and stream handling fixed.
- `Corpus changed`: for various licensing reasons, v.2.0 does not include the scores from the MuseData corpus anymore. This change mostly affects Haydn string quartets and Handel's Messiah. However, new replacement scores are being included and 2.1 will have as many great works as before. The MuseData scores are still available online. MuseData is now a deprecated format and no further testing on it will be conducted; only bug fixes that are easily implemented will be accepted.
- music21 is now available under the BSD license in addition to LGPL!

We will try to stick to something close to the semantic versioning model in the future once v.2.1 is released. In other words, after 2.1, we'll try very hard not to break anything that worked in v.2.1 until v. 3.0 is released. This will probably mean that the version numbers are going to creep up faster in the future.

Still todo before v.2.1 is a major change in how elements are stored in Streams. Stay tuned if you care about performance tweaks etc., otherwise ignore it -- we'll keep the interface the same so you might not notice anything except speed improvements.

Smaller backward-incompatible changes include:
- Stream **repr** now includes a pointer rather than a number if .id is not set. This change will make filtering out doctests easier in the future.
- TinyNotation no longer allows for a two-element tuple where the second element is the time signature. Replace: ("C4 D E", "3/4") with ("tinynotation: 3/4 C4 D E")
- Obscure calls in SpannerBundle have been removed: spannerBundle.getByClassComplete etc.
- Convenience classes: WholeNote, HalfNote, etc. have been removed. Replace with Note(type='whole') etc.
- Old convenience classes for moving from Perl to Python (DefaultHash, defList) have been removed or renamed (defaultlist)
- Articulations are marked as equal if they are of the same class, regardless of other attributes.
- common.almostLessThan, etc. are gone; were only needed for float rounding, and that problem is fixed.
- duration.aggregateTupletRatio is now aggregateTupletMultiplier, which is more correct.
- scala.ScalaStorage renamed scala.ScalaData
- common.nearestMultiplier now returns the signed difference.
- layout -- names changed for consistency (some layout objects had "startMeasure" and some "measureStart" - now they're all the same); now all use namedtuples.
- rarely used functions in Sites, base, Duration, SpannerStorage, VariantStorage, have been removed or renamed. I'd be surprised if these affect anyone outside the development team.

Improvements and bug fixes:
- common.mixedNumeral for working with large rational numbers
- common.opFrac() optionally converts a float, int, or Fraction to a float, int, or Fraction depending on what is necessary to get exact representations. This is a highly optimized function responsible for music21 working with Fractions at about 10x the speed of normal Fraction work.
- Rest objects get a .lineShift attribute for layout.
- staffDetails, printObject MXL had a bug, writing out "True" instead of "yes"
- staffLines is now an int not float. (duh!)
- better checks for reused pointers.
- lots of private methods are now ready for public hacking!
- Lyric.rawText() will return "hel-" instead of "hel" for "hel-lo".

1.9.3a

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

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:

1.8.1

Not secure
Corrects a bug in corpus.search that arose with an empty core.json being created (and committed) in the distribution process.

1.8.0

Not secure
A new release of music21 focusing on Speed and Stability improvements.

Biggest improvement: Streams are now cached on disk after a parse. The first parse of a file will take the same amount of time as before (actually 10-15% slower), but after the first parse, subsequent parses will take 1/10th the time as before. This should be a great savings for software that parses the same files more than once (not necessarily in the same session). This speed improvement comes from two related improvements:

1) Memory footprint of music21 is greatly reduced due to the use of Python **slots** on many frequently created objects that are rarely edited or expanded by users. (Thanks Josiah!)

2) FreezeThaw works well to store or recall the current state of any stream on disk.

Moved from GoogleCode to GitHub (in case you hadn't noticed).

Improvements to Braille processing (Thanks to Mario Lang) and the Vexflow (thanks "Shimpe")

Better handling of local corpora and the Core corpus (and better docs).

Clearer documentation on how to contribute to music21. (Thanks Carol Willing)

Lilypond output now gets the version of lilypond directly.

BETA: work on automatic chord reduction is ongoing. Please let us know if you want to test anything.

Security improvements in a few places.

Added support for Vibraphone in instruments (thanks Chris Culy) and initial support for tablature six-line staves (thanks metalmike).

Lots of bug fixes and improvements (mainly Josiah's great work under the hood). Thanks also to the NEH, the Digging into Data Challenge, the Seaver Foundation, and MIT for support of the project.

Page 7 of 8

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.