Posted May 22, 2024 by mifinti
General notes: There will likely be an update in November/December. There is one more common public-domain Christmas song I missed, and I'm thinking about adding the Nutcracker Suite and maybe a few other Christmas-adjacent classical pieces to Confused Carols. There's also a new game mode in the works that I believe will produce more challenging puzzles, though it's also much more difficult to create puzzles for.
Longer term: The song list is starting to get unwieldy, I'll need to think about how I can better-organize it. I either need to get better at transcription, or find more resources for sheet music. A number of songs I want to include don't have transcriptions that I've found yet, and the few I did myself took an inordinate amount of time to complete. Worst comes to worst, Joplin and Bach might make good puzzles. I also just found an interesting research paper on synthesizing piano strings mathematically.
I have no idea what I'm doing and the translation gets really awkward in places where musical terminology can't be easily found in the dictionary. But it should be intelligible.
The swing-tempo algorithm takes input and looks at pairs of notes. When the pair is near equal-length, the total duration is redistributed to create a long-short pattern of notes. Otherwise the duration is split evenly between the two notes.
+---+---+---+---+---+---+---+---+
| C | D | E | F |
+---+---+---+---+---+---+---+---+
V
+---+---+---+---+---+---+---+---+
| C | D | E | F |
+---+---+---+---+---+---+---+---+
This had a bug when the notes overlapped. The algorithm would attempt to distribute the sum of the note's duration, double-counting the time where the notes overlap. The most obvious resulting error was notes that extended past the end of the measure. Additionally the desired melody is not created as the held length of the note is not as important as the timing between the start of the notes.
+---+---+---+---+---+---+---+---+
| C | F |
+---+---+---+---+---+---+---+---+
| E | | A |
+---+---+ +---+---+
V
+---+---+---+ +---+---+---+
| C | | F |
+---+---+---+---+---+---+---+---+---+
| E | | A ! |
+---+---+---+ +---+---+---+
The new algorithm first shortens each note/chord to eliminate overlap, but remembers what note originally followed it (or if it reached the end of the measure). After the tempo modification is applied, the ends of the notes are adjusted. In addition to fixing the original issues, this preserves any chords in the original that were built up from overlapping notes.
+---+---+---+---+---+---+---+---+
| C | F |
+---+---+---+---+---+---+---+---+
| E | | A |
+---+---+ +---+---+
V
+---+---+ +---+---+
| C | - - > | F | - - >
+---+---+---+---+---+---+---+---+
| E | | A |
+---+---+ +---+---+
V
+---+---+---+ +---+---+---+
| C | > | F | >
+---+---+---+---+---+---+---+---+
| E | | A |
+---+ +---+
V
+---+---+---+---+---+---+---+---+
| C | F |
+---+---+---+---+---+---+---+---+
| E | | A |
+---+ +---+