From reading the decomp, the mid2agb shows a compression algorithm that starts here.
Then it relies on a CalculateCompressionScore method to determine if the whole note is matching enough to be squashed into a patt, and if it is, it goes into CompressWholeNote and marks the whole note as a "pattern", with the specified whole note that it reads from.
That's how it works, at least in the mid2agb version used with the mainline Pokémon games.
Hopefully this can be used as a reference for a possible better compression algorithm too.
From reading the decomp, the mid2agb shows a compression algorithm that starts here.
Then it relies on a CalculateCompressionScore method to determine if the whole note is matching enough to be squashed into a patt, and if it is, it goes into CompressWholeNote and marks the whole note as a "pattern", with the specified whole note that it reads from.
That's how it works, at least in the mid2agb version used with the mainline Pokémon games.
Hopefully this can be used as a reference for a possible better compression algorithm too.