cuthbertLab / music21j

Javascript port of music21 -- Toolkit for Computational Musicology
Other
143 stars 41 forks source link

`RecursiveIterator.stream()` emits `StreamException` for notes in inner streams #201

Open jacobtylerwalls opened 1 year ago

jacobtylerwalls commented 1 year ago
const n = new music21.note.Note("C#");
const m = new music21.stream.Measure();
m.append(n)
const p = new music21.stream.Part();
p.append(m);
const s = p.recurse().stream();
StreamException: An entry for this object is not stored in this Stream.
mscuthbert commented 1 year ago

I've totally forgotten how this works on m21p let alone here. Does it use .template?

jacobtylerwalls commented 1 year ago

No, it just does getOffsetInHierarchy and then a bunch of coreAppend.

I think this is the missing piece: https://github.com/cuthbertLab/music21j/blob/0d7aa31c48f7f697c18e6c3ee7d169d56150ff9b/src/music21/stream/iterator.ts#L167-L170