ESPHome 2026.11.0b6
Loading...
Searching...
No Matches
rtttl.cpp
Go to the documentation of this file.
1#include "rtttl.h"
2#include <algorithm>
3#include <cstring>
4#include <limits>
5#include "esphome/core/hal.h"
6#include "esphome/core/log.h"
8
9namespace esphome::rtttl {
10
11ESPHOME_LOG_TAG(TAG, "rtttl");
12
13static constexpr uint8_t SONG_NAME_LENGTH_LIMIT = 64;
14static constexpr uint8_t SEMITONES_IN_OCTAVE = 12;
15
16static constexpr uint8_t MIN_OCTAVE = 4;
17static constexpr uint8_t MAX_OCTAVE = 7;
18
19static constexpr uint8_t DEFAULT_BPM = 63; // Default beats per minute
20
21// These values can also be found as constants in the Tone library (Tone.h)
22static constexpr uint16_t NOTES[] PROGMEM = {
23 0, 262, 277, 294, 311, 330, 349, 370, 392, 415, 440, 466, 494, 523, 554, 587, 622,
24 659, 698, 740, 784, 831, 880, 932, 988, 1047, 1109, 1175, 1245, 1319, 1397, 1480, 1568, 1661,
25 1760, 1865, 1976, 2093, 2217, 2349, 2489, 2637, 2794, 2960, 3136, 3322, 3520, 3729, 3951};
26static constexpr uint8_t NOTES_COUNT = static_cast<uint8_t>(sizeof(NOTES) / sizeof(NOTES[0]));
27
28static constexpr uint8_t REPEATING_NOTE_GAP_MS = 10;
29
30// Each note fades in and out over 2^5 samples (2 ms at 16 kHz)
31static constexpr uint8_t NOTE_FADE_BITS = 5;
32
33// The first quarter of a sine wave at full scale: round(32767 * sin(i * pi / 128))
34static constexpr uint8_t QUARTER_SINE_BITS = 6;
35static constexpr uint16_t QUARTER_SINE[(1 << QUARTER_SINE_BITS) + 1] PROGMEM = {
36 0, 804, 1608, 2410, 3212, 4011, 4808, 5602, 6393, 7179, 7962, 8739, 9512,
37 10278, 11039, 11793, 12539, 13279, 14010, 14732, 15446, 16151, 16846, 17530, 18204, 18868,
38 19519, 20159, 20787, 21403, 22005, 22594, 23170, 23731, 24279, 24811, 25329, 25832, 26319,
39 26790, 27245, 27683, 28105, 28510, 28898, 29268, 29621, 29956, 30273, 30571, 30852, 31113,
40 31356, 31580, 31785, 31971, 32137, 32285, 32412, 32521, 32609, 32678, 32728, 32757, 32767};
41
42#ifdef USE_SPEAKER
43static constexpr uint16_t SAMPLE_BUFFER_SIZE = 2048;
44static constexpr uint16_t SAMPLE_RATE = 16000;
45#endif // USE_SPEAKER
46
47#if ESPHOME_LOG_LEVEL >= ESPHOME_LOG_LEVEL_VERBOSE
48// RTTTL state strings indexed by State enum (0-4): STOPPED, INIT, STARTING, RUNNING, STOPPING, plus UNKNOWN fallback
49PROGMEM_STRING_TABLE(RtttlStateStrings, "State::STOPPED", "State::INIT", "State::STARTING", "State::RUNNING",
50 "State::STOPPING", "UNKNOWN");
51
52static const LogString *state_to_string(State state) {
53 return RtttlStateStrings::get_log_str(static_cast<uint8_t>(state), RtttlStateStrings::LAST_INDEX);
54}
55#endif // ESPHOME_LOG_LEVEL >= ESPHOME_LOG_LEVEL_VERBOSE
56
57static uint8_t note_index_from_char(char note) {
58 switch (note) {
59 case 'c':
60 return 1;
61 // 'c#': 2
62 case 'd':
63 return 3;
64 // 'd#': 4
65 case 'e':
66 return 5;
67 case 'f':
68 return 6;
69 // 'f#': 7
70 case 'g':
71 return 8;
72 // 'g#': 9
73 case 'a':
74 return 10;
75 // 'a#': 11
76 // Support both 'b' (English notation for B natural) and 'h' (German notation for B natural)
77 case 'b':
78 case 'h':
79 return 12;
80 case 'p':
81 default:
82 return 0;
83 }
84}
85
87 ESP_LOGCONFIG(TAG,
88 "Rtttl:\n"
89 " Gain: %f",
90 this->gain_);
91}
92
94 if (this->state_ == State::STOPPED) {
95 this->disable_loop();
96 return;
97 }
98
99#ifdef USE_OUTPUT
100 if (this->output_ != nullptr && millis() - this->last_note_start_time_ < this->note_duration_) {
101 return;
102 }
103#endif // USE_OUTPUT
104
105#ifdef USE_SPEAKER
106 if (this->speaker_ != nullptr) {
107 if (this->state_ == State::STOPPING) {
108 if (this->speaker_->is_stopped()) {
110 } else {
111 return;
112 }
113 } else if (this->state_ == State::INIT) {
114 if (this->speaker_->is_stopped()) {
115 audio::AudioStreamInfo audio_stream_info = audio::AudioStreamInfo(16, 1, SAMPLE_RATE);
116 this->speaker_->set_audio_stream_info(audio_stream_info);
117 this->speaker_->set_volume(this->gain_);
118 this->speaker_->start();
120 }
121 } else if (this->state_ == State::STARTING) {
122 if (this->speaker_->is_running()) {
124 }
125 }
126 if (!this->speaker_->is_running()) {
127 return;
128 }
129 if (this->samples_sent_ != this->samples_count_) {
130 int16_t sample[SAMPLE_BUFFER_SIZE];
131 uint16_t sample_index = 0;
132
133 while (sample_index < SAMPLE_BUFFER_SIZE && this->samples_sent_ < this->samples_count_) {
134 // Try and send out the remainder of the existing note, one per `loop()`
135 if (this->phase_step_ != 0 && this->samples_sent_ >= this->samples_gap_) { // Play note
136 // The multiplication wraps at exactly one full cycle of the phase
137 sample[sample_index] =
139 this->samples_sent_ - this->samples_gap_, this->samples_count_ - 1 - this->samples_sent_);
140 } else {
141 sample[sample_index] = 0;
142 }
143 this->samples_sent_++;
144 sample_index++;
145 }
146 if (sample_index > 0) {
147 size_t bytes = sample_index * sizeof(int16_t);
148 size_t sent_bytes = this->speaker_->play((uint8_t *) (&sample), bytes);
149 size_t samples_sent = sent_bytes / sizeof(int16_t);
150 if (samples_sent != sample_index) {
151 this->samples_sent_ -= (sample_index - samples_sent);
152 }
153 return;
154 }
155 }
156 }
157#endif // USE_SPEAKER
158
159 // Align to note: most rtttl's out there does not add any space after the ',' separator but just in case
160 while (this->position_ < this->song_len_) {
161 char c = this->song_at_(this->position_);
162 if (c != ',' && c != ' ')
163 break;
164 this->position_++;
165 }
166
167 if (this->position_ >= this->song_len_) {
168 this->finish_();
169 return;
170 }
171
172 // First, get note duration, if available
173 uint8_t note_denominator = this->get_integer_();
174
175 if (note_denominator) {
176 this->note_duration_ = this->wholenote_duration_ / note_denominator;
177 } else {
178 // We will need to check if we are a dotted note after
179 this->note_duration_ = this->wholenote_duration_ / this->default_note_denominator_;
180 }
181
182 uint8_t note_index_in_octave = note_index_from_char(this->song_at_(this->position_));
183
184 this->position_++;
185
186 // Now, get optional '#' sharp
187 if (this->song_at_(this->position_) == '#') {
188 note_index_in_octave++;
189 this->position_++;
190 }
191
192 // Now, get scale
193 uint8_t scale = this->get_integer_();
194 if (scale == 0) {
195 scale = this->default_octave_;
196 }
197
198 if (scale < MIN_OCTAVE || scale > MAX_OCTAVE) {
199 ESP_LOGE(TAG, "Octave must be between %d and %d (it is %d)", MIN_OCTAVE, MAX_OCTAVE, scale);
200 this->finish_();
201 return;
202 }
203
204 // Now, get optional '.' dotted note
205 if (this->song_at_(this->position_) == '.') {
206 this->note_duration_ += this->note_duration_ / 2; // Duration +50%
207 this->position_++;
208 }
209
210 bool need_note_gap = false;
211
212 // Now play the note
213 if (note_index_in_octave == 0) {
214 this->output_freq_ = 0;
215 ESP_LOGVV(TAG, "Waiting: %dms", this->note_duration_);
216 } else {
217 uint8_t note_index = (scale - MIN_OCTAVE) * SEMITONES_IN_OCTAVE + note_index_in_octave;
218 if (note_index >= NOTES_COUNT) {
219 ESP_LOGE(TAG, "Note out of range (note: %d, scale: %d, index: %d, max: %d)", note_index_in_octave, scale,
220 note_index, NOTES_COUNT);
221 this->finish_();
222 return;
223 }
224 uint16_t freq = progmem_read_uint16(&NOTES[note_index]);
225 need_note_gap = freq == this->output_freq_;
226
227 // Add small silence gap between same note
228 this->output_freq_ = freq;
229
230 ESP_LOGVV(TAG, "Playing note: %d for %dms", note_index_in_octave, this->note_duration_);
231 }
232
233#ifdef USE_OUTPUT
234 if (this->output_ != nullptr) {
235 if (this->output_freq_ == 0) {
236 this->output_->set_level(0.0);
237 } else {
238 if (need_note_gap && this->note_duration_ > REPEATING_NOTE_GAP_MS) {
239 this->output_->set_level(0.0);
240 delay(REPEATING_NOTE_GAP_MS);
241 this->note_duration_ -= REPEATING_NOTE_GAP_MS;
242 }
244 this->output_->set_level(this->gain_);
245 }
246 }
247#endif // USE_OUTPUT
248
249#ifdef USE_SPEAKER
250 if (this->speaker_ != nullptr) {
251 this->samples_sent_ = 0;
252 this->samples_gap_ = 0;
253 this->phase_step_ = 0;
254 this->samples_count_ = (SAMPLE_RATE * this->note_duration_) / 1000;
255 if (need_note_gap) {
256 this->samples_gap_ = (SAMPLE_RATE * REPEATING_NOTE_GAP_MS) / 1000;
257 }
258 if (this->output_freq_ != 0) {
259 // Make sure there is enough samples to add a full last sinus.
260 uint32_t samples_wish = this->samples_count_;
261 const uint32_t samples_per_wave = (SAMPLE_RATE << 10) / this->output_freq_;
262
263 uint16_t division = ((this->samples_count_ << 10) / samples_per_wave) + 1;
264
265 this->samples_count_ = (division * samples_per_wave) >> 10;
266 this->phase_step_ = (static_cast<uint64_t>(this->output_freq_) << 32) / SAMPLE_RATE;
267 ESP_LOGVV(TAG, "Calc play time: wish: %" PRIu32 " gets: %" PRIu32 " (div: %d spw: %" PRIu32 ")", samples_wish,
268 this->samples_count_, division, samples_per_wave);
269 }
270 // Convert from frequency in Hz to high and low samples in fixed point
271 }
272#endif // USE_SPEAKER
273
275}
276
278 static constexpr uint8_t QUARTER_BITS = 30;
279 static constexpr uint32_t QUARTER_MASK = (1UL << QUARTER_BITS) - 1;
280 // The second and fourth quarters of the wave read the table backwards
281 const uint32_t position = ((phase >> QUARTER_BITS) & 1) != 0 ? ~phase & QUARTER_MASK : phase & QUARTER_MASK;
282 const uint8_t index = position >> (QUARTER_BITS - QUARTER_SINE_BITS);
283 const int32_t fraction = (position >> (QUARTER_BITS - QUARTER_SINE_BITS - 16)) & 0xFFFF;
284 const int32_t low = progmem_read_uint16(&QUARTER_SINE[index]);
285 const int32_t high = progmem_read_uint16(&QUARTER_SINE[index + 1]);
286 const int32_t value = low + (((high - low) * fraction) >> 16);
287 return static_cast<int16_t>((phase >> 31) != 0 ? -value : value);
288}
289
290int16_t Rtttl::fade_sample(int16_t value, uint32_t from_start, uint32_t to_end) {
291 const uint32_t edge = std::min(from_start, to_end);
292 if (edge >= (1U << NOTE_FADE_BITS))
293 return value;
294 return static_cast<int16_t>((value * static_cast<int32_t>(edge)) >> NOTE_FADE_BITS);
295}
296
297void Rtttl::play(std::string rtttl) {
298 if (this->is_busy_()) {
299 return;
300 }
301 this->owned_song_ = std::move(rtttl);
302 this->set_song_(this->owned_song_.data(), this->owned_song_.size());
303 this->start_();
304}
305
307 if (this->is_busy_()) {
308 return;
309 }
310 // Release a previously owned song; the static one needs no storage.
311 std::string().swap(this->owned_song_);
312 const char *data = reinterpret_cast<const char *>(song.rtttl);
313 this->set_song_(data, ESPHOME_strlen_P(data));
314 this->start_();
315}
316
317void Rtttl::set_song_(const char *song, size_t len) {
318 this->song_ = song;
319 // Anything past what the 16 bit length holds is dropped; the validator keeps configured songs shorter.
320 this->song_len_ = static_cast<uint16_t>(std::min<size_t>(len, std::numeric_limits<uint16_t>::max()));
321}
322
323bool Rtttl::is_busy_() const {
324 if (this->state_ == State::STOPPED || this->state_ == State::STOPPING) {
325 return false;
326 }
327 char name[SONG_NAME_LENGTH_LIMIT + 1];
328 this->song_name_(name, sizeof(name), this->song_find_(':', 0, this->song_len_));
329 ESP_LOGW(TAG, "Already playing: %s", name);
330 return true;
331}
332
333size_t Rtttl::song_find_(char c, size_t from, size_t end) const {
334 for (size_t pos = from; pos < end; pos++) {
335 if (this->song_at_(pos) == c)
336 return pos;
337 }
338 return end;
339}
340
341size_t Rtttl::song_find_control_(char key, size_t from, size_t end) const {
342 size_t pos = from;
343 while ((pos = this->song_find_(key, pos, end)) < end) {
344 if (this->song_at_(pos + 1) == '=')
345 return pos;
346 pos++;
347 }
348 return end;
349}
350
351void Rtttl::song_name_(char *buf, size_t size, size_t name_len) const {
352 size_t len = std::min(name_len, size - 1);
353 for (size_t pos = 0; pos < len; pos++) {
354 buf[pos] = this->song_at_(pos);
355 }
356 buf[len] = '\0';
357}
358
362 this->note_duration_ = 0;
363
364 uint16_t bpm = DEFAULT_BPM;
365 uint16_t num; // Used for: default note-denominator, default octave, BPM
366
367 // Get name
368 this->position_ = this->song_find_(':', 0, this->song_len_);
369
370 if (this->position_ == this->song_len_) {
371 ESP_LOGE(TAG, "Unable to determine name; missing ':'");
372 return;
373 }
374 if (this->position_ >= SONG_NAME_LENGTH_LIMIT) {
375 ESP_LOGE(TAG, "Name is too long: length=%u, limit=%u", static_cast<unsigned>(this->position_),
376 static_cast<unsigned>(SONG_NAME_LENGTH_LIMIT));
377 return;
378 }
379 char name[SONG_NAME_LENGTH_LIMIT + 1];
380 this->song_name_(name, sizeof(name), this->position_);
381 ESP_LOGD(TAG, "Playing song %s", name);
382
383 size_t name_end_position = this->position_;
384 size_t control_end = this->song_find_(':', name_end_position + 1, this->song_len_);
385 if (control_end == this->song_len_) {
386 ESP_LOGE(TAG, "Missing second ':'");
387 return;
388 }
389
390 // Get default duration
391 size_t pos = this->song_find_control_('d', name_end_position, control_end);
392 if (pos == control_end) {
393 ESP_LOGW(TAG, "Missing 'd='; use default duration %d", this->default_note_denominator_);
394 } else {
395 this->position_ = pos + 2;
396 num = this->get_integer_();
397 if (num == 1 || num == 2 || num == 4 || num == 8 || num == 16 || num == 32) {
398 this->default_note_denominator_ = num;
399 } else {
400 ESP_LOGE(TAG, "Invalid default duration: %d", num);
401 return;
402 }
403 }
404
405 // Get default octave
406 pos = this->song_find_control_('o', name_end_position, control_end);
407 if (pos == control_end) {
408 ESP_LOGW(TAG, "Missing 'o='; use default octave %d", this->default_octave_);
409 } else {
410 this->position_ = pos + 2;
411 num = this->get_integer_();
412 if (num >= MIN_OCTAVE && num <= MAX_OCTAVE) {
413 this->default_octave_ = num;
414 } else {
415 ESP_LOGE(TAG, "Invalid default octave: %d", num);
416 return;
417 }
418 }
419
420 // Get BPM
421 pos = this->song_find_control_('b', name_end_position, control_end);
422 if (pos == control_end) {
423 ESP_LOGW(TAG, "Missing 'b='; use default BPM %d", bpm);
424 } else {
425 this->position_ = pos + 2;
426 num = this->get_integer_();
427 if (num >= 4) { // Below 4 is not realistic and would cause a integer overflow
428 bpm = num;
429 } else {
430 ESP_LOGE(TAG, "Invalid BPM: %d", num);
431 return;
432 }
433 }
434
435 this->position_ = control_end + 1;
436
437 // BPM usually expresses the number of quarter notes per minute
438 this->wholenote_duration_ = 60 * 1000L * 4 / bpm; // This is the time for whole note (in milliseconds)
439
440 this->output_freq_ = 0;
442 this->note_duration_ = 1;
443
444#ifdef USE_OUTPUT
445 if (this->output_ != nullptr) {
447 }
448#endif // USE_OUTPUT
449
450#ifdef USE_SPEAKER
451 if (this->speaker_ != nullptr) {
452 this->set_state_(State::INIT);
453 this->samples_sent_ = 0;
454 this->samples_count_ = 0;
455 }
456#endif // USE_SPEAKER
457}
458
460#ifdef USE_OUTPUT
461 if (this->output_ != nullptr) {
462 this->output_->set_level(0.0);
464 }
465#endif // USE_OUTPUT
466
467#ifdef USE_SPEAKER
468 if (this->speaker_ != nullptr) {
469 if (this->speaker_->is_running()) {
470 this->speaker_->stop();
471 }
473 }
474#endif // USE_SPEAKER
475
476 this->position_ = this->song_len_;
477 this->note_duration_ = 0;
478}
479
481 ESP_LOGV(TAG, "Rtttl::finish_()");
482
483#ifdef USE_OUTPUT
484 if (this->output_ != nullptr) {
485 this->output_->set_level(0.0);
487 }
488#endif // USE_OUTPUT
489
490#ifdef USE_SPEAKER
491 if (this->speaker_ != nullptr) {
492 int16_t sample[2] = {0, 0};
493 this->speaker_->play((uint8_t *) (&sample), sizeof(sample));
494 this->speaker_->finish();
496 }
497#endif // USE_SPEAKER
498
499 // Ensure no more notes are played in case finish_() is called for an error.
500 this->position_ = this->song_len_;
501 this->note_duration_ = 0;
502}
503
505 State old_state = this->state_;
506 this->state_ = state;
507 ESP_LOGV(TAG, "State changed from %s to %s", LOG_STR_ARG(state_to_string(old_state)),
508 LOG_STR_ARG(state_to_string(state)));
509
510 // Clear loop_done when transitioning from `State::STOPPED` to any other state
511 if (state == State::STOPPED) {
512 this->disable_loop();
513#ifdef USE_RTTTL_FINISHED_PLAYBACK_CALLBACK
515#endif
516 ESP_LOGD(TAG, "Playback finished");
517 } else if (old_state == State::STOPPED) {
518 this->enable_loop();
519 }
520}
521
522} // namespace esphome::rtttl
void enable_loop()
Enable this component's loop.
Definition component.h:261
void disable_loop()
Disable this component's loop.
void set_level(float state)
Set the level of this float output, this is called from the front-end.
virtual void update_frequency(float frequency)
Set the frequency of the output for PWM outputs.
std::string owned_song_
Backing store for play(std::string).
Definition rtttl.h:112
size_t song_find_(char c, size_t from, size_t end) const
Index of the first c in [from, end), or end when absent.
Definition rtttl.cpp:333
uint32_t last_note_start_time_
The time in milliseconds since microcontroller boot when the last note was started.
Definition rtttl.h:114
uint32_t phase_step_
How far the phase moves per sample, where the full uint32_t range is one cycle; 0 for a rest.
Definition rtttl.h:143
uint8_t default_note_denominator_
The default duration of a note (e.g. 4 for a quarter note).
Definition rtttl.h:128
uint16_t position_
The current position in the song.
Definition rtttl.h:122
bool is_busy_() const
Logs and returns true when a song is still playing, so a new one must wait.
Definition rtttl.cpp:323
uint16_t note_duration_
The duration of the current note in milliseconds.
Definition rtttl.h:124
uint16_t song_len_
Length of the song in bytes; songs are a few hundred bytes, so 16 bits is ample.
Definition rtttl.h:120
void start_()
Parses the header and starts playback of the song the view points at.
Definition rtttl.cpp:359
uint32_t samples_sent_
The number of samples sent.
Definition rtttl.h:145
output::FloatOutput * output_
The output to write the sound to.
Definition rtttl.h:136
uint16_t get_integer_()
Definition rtttl.h:69
static int16_t sine_sample(uint32_t phase)
The value of a full scale sine wave at phase, where the full uint32_t range is one cycle.
Definition rtttl.cpp:277
void dump_config() override
Definition rtttl.cpp:86
void set_state_(State state)
Definition rtttl.cpp:504
void finish_()
Finalizes the playback of the RTTTL string.
Definition rtttl.cpp:480
static int16_t fade_sample(int16_t value, uint32_t from_start, uint32_t to_end)
Scales a sample near either end of a note, so the note does not click when the wave starts or stops a...
Definition rtttl.cpp:290
float gain_
The gain of the output.
Definition rtttl.h:118
uint8_t default_octave_
The default octave for a note.
Definition rtttl.h:130
uint32_t output_freq_
The frequency of the current note in Hz.
Definition rtttl.h:116
void loop() override
Definition rtttl.cpp:93
uint32_t samples_gap_
The number of samples for the gap between notes.
Definition rtttl.h:149
char song_at_(size_t pos) const
The byte of the song at pos, or NUL past its end; the read is flash safe for a PROGMEM song on ESP826...
Definition rtttl.h:77
uint32_t samples_count_
The total number of samples to send.
Definition rtttl.h:147
uint16_t wholenote_duration_
The duration of a whole note in milliseconds.
Definition rtttl.h:126
const char * song_
The song being played; points at owned_song_ or at static storage.
Definition rtttl.h:110
size_t song_find_control_(char key, size_t from, size_t end) const
Index of key followed by '=' in [from, end), or end when absent.
Definition rtttl.cpp:341
void song_name_(char *buf, size_t size, size_t name_len) const
Copies the first name_len bytes of the song, its name, into buf for logging.
Definition rtttl.cpp:351
State state_
The current state of the RTTTL player.
Definition rtttl.h:132
speaker::Speaker * speaker_
The speaker to write the sound to.
Definition rtttl.h:141
CallbackManager< void()> on_finished_playback_callback_
The callback to call when playback is finished.
Definition rtttl.h:154
void set_song_(const char *song, size_t len)
Points the view at a song, clamped to what song_len_ can hold.
Definition rtttl.cpp:317
void play(std::string rtttl)
Play a song; the string is copied so it may come from anywhere.
Definition rtttl.cpp:297
virtual size_t play(const uint8_t *data, size_t length)=0
Plays the provided audio data.
bool is_running() const
Definition speaker.h:68
virtual void set_volume(float volume)
Definition speaker.h:74
void set_audio_stream_info(const audio::AudioStreamInfo &audio_stream_info)
Definition speaker.h:104
virtual void start()=0
virtual void finish()
Definition speaker.h:60
bool is_stopped() const
Definition speaker.h:69
virtual void stop()=0
float position
Definition cover.h:0
const char * key
bool state
Definition fan.h:2
constexpr uint8_t DEFAULT_OCTAVE
Definition rtttl.h:23
constexpr uint8_t DEFAULT_NOTE_DENOMINATOR
Definition rtttl.h:22
ESPHOME_LOG_TAG(TAG, "rtttl")
PROGMEM_STRING_TABLE(RtttlStateStrings, "State::STOPPED", "State::INIT", "State::STARTING", "State::RUNNING", "State::STOPPING", "UNKNOWN")
uint32_t value
Definition hal.cpp:41
const void size_t len
Definition hal.h:68
uint16_t size
Definition helpers.cpp:34
size_t size_t pos
Definition helpers.h:1333
uint16_t progmem_read_uint16(const uint16_t *addr)
Definition hal.h:53
void HOT delay(uint32_t ms)
Definition hal.cpp:85
uint32_t IRAM_ATTR HOT millis()
Definition hal.cpp:25
static void uint32_t
A song in storage that outlives playback, such as a literal from generated code; PROGMEM on ESP8266.
Definition rtttl.h:35
uint8_t end[39]
Definition sun_gtil2.cpp:17