Happy Prez Day everybody. Made a lot of progress this weekend on the overall stability of the stream and a lot of it was due to conceptual shift in what a "stream" represents. I'd like to wax philosophical about it for a moment.
It takes a while for the Aleator to render the MIDI for an entire movement, let a lone a set of them. As a listener, my favorite format of recorded music is the album. Songs are great, but putting together a well crafted album that is engaging for its entire duration is extremely difficult to do.
When applied to the stream though, the problem is that 99.9% of all listeners will be joining it in progress. There is no real way to control what is perceived as the beginning, middle or end of the stream. In essence, they don't exist.
Previously, the MIDI for the entire set of compositions would be loaded into memory at the beginning of each cycle. As I said - that took a while, so I would start a separate background thread to spin up the new set as the current one was ending. This multithreading worked fine in the short term, but seemed to cause memory problems when the plugin ran for an extended amount of time (4+ hours). My gut instinct tells me that something in one or some of the libraries I am using isn't thread safe, but I digress.
Looking back on it, it's awful design...I just fell into the trap of thinking of the whole thing as a single unit that needed to be dealt with as such. The fact that I can't force a listener to the beginning really forced me out of that mentality. Now, one composition is loaded at a time, and added to a list of compositions that have already been played. When looking to load the next composition, the plugin randomly selects one that hasn't already been played. This continues until all compositions have been played, at which time that list is cleared out and the process starts all over again. It will still play through all included compositions without repeating, but the sequence is random.
This approach is really inline with the general direction of the project, a part of which is to walk the line between control and chance in our algorithms. And the best part, of course, is that loading one composition at a time allows everything to run on a single thread, leading to increased stability overall.
It doesn't make sense to think of these resulting streams in a linear sense with respect to any sort of track sequence. There literally isn't one. Ideally, we want the listener to observer a stream aurally in much the same way they would take in piece of visual art. There can be edges or borders, but it doesn't really have beginnings and endings. It's just there, existing.
I'm gonna step away from the dev stuff for a second and do another music post next time, promise.