Closed sildater closed 3 months ago
If you only cares about note, you could just use the extend method of note list.
tracks[0].notes.extend(tracks[1].notes)
Currently, extend's interface semantics are different from Python's (in symusic it will lead to a deep copy); I'll try to align it with the Python list later on. #32
Also, you may have conflicts when merging other events, such as pedals. Like miditoolkit, symusic parses it as an event with a duration, and the inner restriction is that there can't be a time overlap. Merging it directly will cause some problems. Of course, we now ignore pedals when writing to midi, because the original information is in the control change. #5
The reason I didn't provide such a function is because having different programs for different tracks (id of instrument in midi standard) inherently prevents them from being merged together, let alone the various "tack local" events that can create a lot of potential conflicts.
So, I think the best option at the moment is for the user to think of a suitable merging strategy and then construct the new midi out of that
thank you for the reply! yes there is more that could go wrong, but in my case the extend method will do fine.
Hi! Thanks for the great library! I have a feature request that might already be there, but I didn't find it: is it possible to merge all tracks in a score object into a single track? I'm aware this could create issues with the same pitch being played at the same time in different tracks, but for several of my files it should work.