FastArduino v1.10
C++ library to build fast but small Arduino/AVR projects
|
Defines API for audio tones (square waves) generation and simple melodies playing. More...
Namespaces | |
namespace | SpecialTone |
This namespace defines special "tones" which have an impact on how to play a melody. | |
Classes | |
class | AbstractTonePlayer |
This low-level API defines an abstract player of melodies (defined as a sequence of tones and durations). More... | |
class | AsyncTonePlayer |
This API defines a player of melodies, defined as a sequence of tones and durations. More... | |
class | Beat |
This embeds minimum duration (duration of a 32nd note), in milliseconds, for a given tempo (beats per minute). More... | |
class | QTonePlay |
An optimized surrogate to TonePlay structure. More... | |
class | ToneGenerator |
API class for tone generation to a buzzer (or better an amplifier) connected to pin OUTPUT . More... | |
class | TonePlay |
This struct is the unit data manipulated by TonePlayer : it describes one Tone along with its duration in milliseconds. More... | |
class | TonePlayer |
This API defines a player of melodies, defined as a sequence of tones and durations. More... | |
Enumerations | |
enum class | Duration : uint8_t { WHOLE = 32 , HALF = 16 , QUARTER = 8 , EIGHTH = 4 , SIXTEENTH = 2 , SEMI_BREVE = WHOLE , MINIM = HALF , CROTCHET = QUARTER , QUAVER = EIGHTH , SEMI_QUAVER = SIXTEENTH } |
Possible duration of a note, following music theory. More... | |
enum class | Tone : uint16_t { USER0 = 0 , USER1 , USER2 , USER3 , USER4 , USER5 , USER6 , USER7 , SILENCE = USER7 + 1 , REST = SILENCE , C0 = 131 , Cs0 = 139 , Df0 = Cs0 , D0 = 147 , Ds0 = 156 , Ef0 = Ds0 , E0 = 165 , F0 = 175 , Fs0 = 185 , Gf0 = Fs0 , G0 = 196 , Gs0 = 208 , Af0 = Gs0 , A0 = 220 , As0 = 233 , Bf0 = As0 , B0 = 247 , C1 = 262 , Cs1 = 277 , Df1 = Cs1 , D1 = 294 , Ds1 = 311 , Ef1 = Ds1 , E1 = 330 , F1 = 349 , Fs1 = 370 , Gf1 = Fs1 , G1 = 392 , Gs1 = 415 , Af1 = Gs1 , A1 = 440 , As1 = 466 , Bf1 = As1 , B1 = 494 , C2 = 523 , Cs2 = 554 , Df2 = Cs2 , D2 = 587 , Ds2 = 622 , Ef2 = Ds2 , E2 = 659 , F2 = 698 , Fs2 = 740 , Gf2 = Fs2 , G2 = 784 , Gs2 = 831 , Af2 = Gs2 , A2 = 880 , As2 = 932 , Bf2 = As2 , B2 = 988 , C3 = 1046 , Cs3 = 1109 , Df3 = Cs3 , D3 = 1175 , Ds3 = 1245 , Ef3 = Ds3 , E3 = 1319 , F3 = 1397 , Fs3 = 1480 , Gf3 = Fs3 , G3 = 1568 , Gs3 = 1662 , Af3 = Gs3 , A3 = 1760 , As3 = 1865 , Bf3 = As3 , B3 = 1976 , C4 = 2093 , Cs4 = 2217 , Df4 = Cs4 , D4 = 2349 , Ds4 = 2489 , Ef4 = Ds4 , E4 = 2637 , F4 = 2794 , Fs4 = 2960 , Gf4 = Fs4 , G4 = 3136 , Gs4 = 3322 , Af4 = Gs4 , A4 = 3520 , As4 = 3729 , Bf4 = As4 , B4 = 3951 } |
This enum defines all possible audio tones that can be generated. More... | |
Functions | |
static constexpr Duration | dotted (Duration d) |
Transforms a note duration to its dotted value (1.5 times the given duration). More... | |
static constexpr Duration | triplet (Duration d) |
Transforms a note duration to allow it to use in a triplet. More... | |
Defines API for audio tones (square waves) generation and simple melodies playing.
|
strong |
Possible duration of a note, following music theory.
The shortest duration supported is the semi-quaver (or sixteenth). Synonyms are also defined when they exist.
The uint8_t
value is the multiplier to apply to the duration of a 32th note to get the actual duration (in 4 quarters time signature).
A note duration can be altered by:
Definition at line 103 of file tone_player.h.
|
strong |
This enum defines all possible audio tones that can be generated.
This also defnes "special" values that are not actual tones but are reserved for user purposes or for silences:
USER0
... USER7
: can be used for any purpose defined by the end-developerSILENCE
or REST
: used to play no tone at all All other tones are named according to their musical note (in English scale), and their octave,. This is similar to the usual Scientific Pitch Notation except for the octave index which is different: in this enum, the standard tuning pitch (440Hz) is A1
instead of A4
in SPN.Sharps are noted as s
between the note and its octave, as in Cs0
. Flats are noted as f
between the note and its octave, as in Df0
.
Please note that each tone can be converted to a uint16_t
which is its playing frequency.
Transforms a note duration to its dotted value (1.5 times the given duration).
Definition at line 133 of file tone_player.h.
Transforms a note duration to allow it to use in a triplet.
Definition at line 141 of file tone_player.h.