While looking at this, I wondered if we could expand the code and permit the lengthening of a bar ... for example, I had a song in 4/4 time which had a couple of 5/4 bars. I had been using Truncate to generate a 1/4 bar, followed by a 4/4 to create it.
Well, the short story is that I can't really figure out how to do it and make it useful. Here are some of the problems I ran into:
- Expanding to a single multiple (4/4 to 8/4) isn't too bad. But, if the code is to be robust, it should work for goofy stuff like 10/4 as well. I could limit to doubling, but read on.
- When selecting which patterns to re-create and move into the new slots it becomes difficult to decide which ones to use. A facile implementation might take (for my 4/4 to 5/4 case) patterns in the first beat and copy them to the fifth .... and this is the exact opposite of using Truncate with a 1/4, 4/4 pattern. So, should we copy an existing sequence and insert at the left? Insert what?
- It becomes even sillier when patterns not-on-the-beat are involved.
So, unless someone smarter than me can come up with a algorithm for this, I'm going to continue to suggest "use a single short bar followed by a long one" advice.
Got a great idea? Let me know.