Closed minamouse closed 8 years ago
_import_score()
is called from run()
when required, and not called from __init__()
. This is intentional lazy loading to help reduce peak memory consumption of music21 Score objects. In summer 2013, 16 GB of RAM wasn't enough for even 20 average Score objects at once. This is much better now, but I still defend the lazy loading strategy here.
Many other things could use improvement though! You could make _import_score()
into a public method, add an autoload
kwarg to __init__()
that calls import_score()
immediately, and/or other things.
(If you start wondering about the init_metadata()
inner function in __init__()
: there's no good reason for it).
Perhaps @mborsodi you could have any changes you think would be useful ready for the hack day and the three of us could look over them all together. This issue also interests me because I recently found out that the length of a pick-up is stored in the metadata. This could be useful to make the offset filter start on the first downbeat or other reasonable starting point rather than just the first note of the piece as it does now (these offset filter comments are related to #173 and #356).
I don't think we need to change anything here.
So, I realized that the reason it wasn't working is because there was no run()
function in _indexed_piece()
. I added it and called import score from there.
@crantila in indexed_piece.py, it seems that _import_score(), which assigns values to the metadata fields doesn't get called. That is, when I do this, I get nothing back:
but this works:
Is there a reason for this, or something I'm missing?