…while experimenting with sound I made a fork of ArduboyTones, re-factoring it to work the way NewTone does (using ICR3 instead of OCR3A, and using millis() for duration instead of a toggleCount):
Anyway, with these changes the example sketch compiles using 10 bytes less PROGMEM - so for anyone really at the edge and desperate for any bytes they can scrounge up, here’s another potential 10 bytes for you!
I am not kidding you … I am trying to fix a couple of small things in Kong II and I am 8 bytes over. I will take those 10 bytes thank you!
Ha! Well that’s a happy coincidence!
You could also probably safely comment these two lines out of the noTone() function I have in there, and save a little more maybe?
TCCR3B = _BV(CS31); // Default clock prescaler of 8.
TCCR3A = _BV(WGM30); // Set to defaults so PWM can work like normal (PWM, phase corrected, 8bit).
Without commenting those two lines out, I save 74 bytes - better than your quoted 10!
Yeah, not sure I did it right so swapped back to the original library recompiled and swapped back again … just to be sure, to be sure.