Closed abbrev closed 1 year ago
Really sorry I missed this (still relatively new to GitHub, didn't know this was a thing). You're absolutely right, the frequency values are off. I think they're based off the AVR code, which was tweaked so that it played A=440Hz on the microcontroller I was using. The actual note values weren't mapped correctly though, so C doesn't equal C, C# doesn't equal C# etc., but the tuning itself is correct (on that one specific micro). At the time I didn't care what key the pieces were in, just that they sounded good in the closest key.
It may mess up the example songs, but at this point I'd rather the tunings were correct for others using the software, so I've added your correction. Thanks very much for looking into this!
When I converted some music to μMML and then converted it to a WAV file with the desktop player, I found that the notes are too high in frequency. A D5 in the song played at about 943 Hz but should be about 587 Hz. Turned out the
note
array had the wrong values for the sample rate the player runs at (215 kHz). For example, A1 is 55 Hz, so the note value should be 215000/4/55 ≈ 977 (the divide by 4 is because the player interleaves 4 voices), but the value in thenote
array is 609.The other option is to change the sample rate to 134 kHz, and then the note value would be correct (but that would also affect the tempo).
I have not tested the AVR player, so I don't know if it has the same issue (and it doesn't have an explicitly specified sample rate). If it effectively runs at a 134 kHz sample rate then the frequencies are correct.