I’ve created a new library which generates tones and tone sequences, for playing sound effects and simple music in Arduboy sketches, called ArduboyTones. It is simple to use and efficient. It creates substantially less code than the ArduboyPlaytune library, or even the Arduino tone() function.
Features of ArduboyTones are:
Like ArduboyPlaytune and Arduino tone(), sounds are played using interrupts in the background, while the “real” code continues to run in the foreground.
Plays 1, 2 or 3 tones in sequence, using the tone() function, or any length sequence stored in an array, using the tones() or tonesInRAM() functions.
Durations of silence (musical rests) can be included.
Each tone can be played at normal volume or a higher volume. High volume drives the speaker at twice the voltage.
Sound can be globally muted using the standard Arduboy audio.on() and audio.off() functions.
Uses only timer 3, so the Arduboy’s RGB LED will work properly using setRGBled() without conflict, unlike Arduboy V1.1 or the ArduboyPlaytune library.
The library is “hard coded” for the Arduboy hardware, so the sketch doesn’t have to specify the speaker pins in any function calls.
Because ArduboyTones takes over the timer 3 interrupt, it can’t be used with the Arduboy library V1.1 which grabs the timer 3 interrupt for its tunes functions. If you wish to use ArduboyTones in your sketch, you should use my Arduboy2 library for the main API.
Update: I’ve decided to just maintain AduboyTones in my own repository as given above.
@ekem and/or other people of authority,
If you want ArduboyTones to become an “official” library, just say the word and create a new ArduboyTones repository under the Arduboy user on GitHub. I’ll try to get it up and running as quickly as possible. We could then start the process of making it available through the Arduino IDE Library Manager.