From 24b9bab4f1cd5cde25365f096328e11dfdf25340 Mon Sep 17 00:00:00 2001 From: Mark Jocas Date: Mon, 1 Jun 2026 16:21:47 +0200 Subject: [PATCH] Enhances buzzer audibility on small piezos Adjusts the duration and tempo of several buzzer melodies to make them more perceptible. Specifically, the advert sent and generic toggle sounds are modified with longer note durations and slower tempos, improving their clarity on typical small piezo speakers. --- examples/companion_radio/ui-new/UITask.cpp | 2 +- examples/companion_radio/ui-orig/UITask.cpp | 2 +- examples/companion_radio/ui-tiny/UITask.cpp | 2 +- src/helpers/ui/buzzer.cpp | 3 ++- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/examples/companion_radio/ui-new/UITask.cpp b/examples/companion_radio/ui-new/UITask.cpp index 98423b230..9c9223150 100644 --- a/examples/companion_radio/ui-new/UITask.cpp +++ b/examples/companion_radio/ui-new/UITask.cpp @@ -610,7 +610,7 @@ switch(t){ buzzer.play("ack:d=32,o=8,b=120:c"); break; case UIEventType::advertSent: - buzzer.play("Advert:d=16,o=6,b=240:c,e,g,c7"); + buzzer.play("Advert:d=8,o=6,b=180:c,e,g,c7"); break; case UIEventType::roomMessage: case UIEventType::newContactMessage: diff --git a/examples/companion_radio/ui-orig/UITask.cpp b/examples/companion_radio/ui-orig/UITask.cpp index 5733fefb2..83aa4c3cc 100644 --- a/examples/companion_radio/ui-orig/UITask.cpp +++ b/examples/companion_radio/ui-orig/UITask.cpp @@ -104,7 +104,7 @@ switch(t){ buzzer.play("ack:d=32,o=8,b=120:c"); break; case UIEventType::advertSent: - buzzer.play("Advert:d=16,o=6,b=240:c,e,g,c7"); + buzzer.play("Advert:d=8,o=6,b=180:c,e,g,c7"); break; case UIEventType::roomMessage: case UIEventType::newContactMessage: diff --git a/examples/companion_radio/ui-tiny/UITask.cpp b/examples/companion_radio/ui-tiny/UITask.cpp index 3274baa4c..03d84e4cf 100644 --- a/examples/companion_radio/ui-tiny/UITask.cpp +++ b/examples/companion_radio/ui-tiny/UITask.cpp @@ -482,7 +482,7 @@ switch(t){ buzzer.play("ack:d=32,o=8,b=120:c"); break; case UIEventType::advertSent: - buzzer.play("Advert:d=16,o=6,b=240:c,e,g,c7"); + buzzer.play("Advert:d=8,o=6,b=180:c,e,g,c7"); break; case UIEventType::roomMessage: case UIEventType::newContactMessage: diff --git a/src/helpers/ui/buzzer.cpp b/src/helpers/ui/buzzer.cpp index 1410cf7f1..4ac7e74c7 100644 --- a/src/helpers/ui/buzzer.cpp +++ b/src/helpers/ui/buzzer.cpp @@ -50,7 +50,8 @@ void genericBuzzer::playToggle(int count, bool enabled) { if (count < 1) count = 1; if (count > max_notes) count = max_notes; char melody[64]; - int n = snprintf(melody, sizeof(melody), "Tg:d=16,o=6,b=200:"); + // d=8 (eighths) at b=180 -> ~166 ms per note, audible on small piezos. + int n = snprintf(melody, sizeof(melody), "Tg:d=8,o=6,b=180:"); for (int i = 0; i < count && n < (int)sizeof(melody); i++) { int idx = enabled ? i : (count - 1 - i); n += snprintf(melody + n, sizeof(melody) - n, "%s%s", i ? "," : "", notes[idx]);