Skip to content

Add bot speak sound words for piezo buzzers - #3676

Open
ktobias-dev wants to merge 2 commits into
meshcore-dev:devfrom
ktobias-dev:feature/bot-speak
Open

ktobias-dev wants to merge 2 commits into
meshcore-dev:devfrom
ktobias-dev:feature/bot-speak

Conversation

@ktobias-dev

Copy link
Copy Markdown

Closes #3675

Summary

Received messages that contain certain words play short robot-style chirps, sweeps and warbles on the piezo buzzer, instead of the normal notify tune. Nothing changes on the wire: the receiver recognizes words in the plain text and synthesizes the sound locally.

Word(s) Sound
happy rising chirps ending in a warble
sad long falling whistle
question flat beep, then a rising glide
excited shimmer, fast zig-zags, sparkle trill
alarm accelerating siren with a double shriek
chatter three short "words" ending like a statement
ack beep-boop
razz low buzzy blat
surprised blip, then a fast whoop
hello / goodbye cheerful wake-up chirps / two-syllable sign-off
uh-oh, uh oh, uhoh rising "uh", buzzy falling "oh"
low battery three drooping tones, the last sagging out
yes, y single bell ding
no, n low double buzz

Changes

  • src/helpers/ui/botspeak_sounds.h (new): each sound is a table of 4-byte segments: start/end frequency, duration (4 ms units) and vibrato rate/depth, written with a BOT_SEG(f0_hz, f1_hz, ms, vib_hz, vib_depth_hz) macro. Also holds the word table. Only buzzer.cpp includes it.
  • genericBuzzer: a non-blocking sweep player, playBot(segs, count). It glides exponentially from f0 to f1 and updates tone() every 2 ms from loop(). playWords(text) queues up to 4 matched sounds with a 150 ms gap between them. Starting an RTTTL tune stops a bot sound and vice versa, and quiet(true) stops playback. Existing RTTTL behavior is unchanged.
  • ui-tiny: onMessageRecv / onChannelMessageRecv call buzzer.playWords() after notify(), so vibration still fires and a matched word replaces the tune. For channel messages the <sender>: prefix is skipped first.
  • Phone setting: new NodePrefs::bot_with_phone, saved as comp.bot_ph and off by default. When off, sound words follow the existing "only when no phone is connected" rule. A new "bot speak" home page toggles it; turning it on plays "happy" as confirmation.

Notes

  • Matching is plain, case-insensitive, whole-word, so normal chat like "hello all" or "happy birthday" will play sounds. That was a deliberate choice over :emoji:-style tokens, but it's easy to change if you prefer.
  • Only ui-tiny is wired up so far. ui-new and ui-orig boards build with the new buzzer code but don't call playWords() yet. I can add that here or in a follow-up.
  • Sounds sit mostly in the 1–4 kHz range, where small piezos are loudest.

Testing

  • LilyGo_T-Echo_Card_companion_radio_ble builds on this branch (RAM 62.6%, Flash 49.8%).
  • heltec_v4_r8_companion_radio_ble (ESP32, has a buzzer) built successfully with the player code before the final rename and rebase onto dev. It hasn't been rebuilt since.
  • On a T-Echo Card (flashed with the same changes on a main-based build): every sound plays correctly when a direct or channel message is received, and the "bot speak" page and phone setting work as expected.

🤖 Generated with Claude Code

ktobias-dev and others added 2 commits October 24, 2026 22:42
Received messages containing sound words (happy, sad, question, excited,
alarm, chatter, ack, razz, surprised, hello, goodbye, uh-oh, low battery)
play short robot-style chirps, sweeps and warbles on the buzzer instead
of the normal notify tune. Up to 4 words per message play in order.

- botspeak_sounds.h: sounds as compact 4-byte segments (start/end freq,
  duration, vibrato) plus the word table
- genericBuzzer: non-blocking sweep player driving tone() every 2 ms
- ui-tiny: hooks for contact and channel messages (sender name is
  skipped), and a "bot speak" home page to toggle playing sound words
  while a phone is connected (saved as comp.bot_ph, off by default)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
"yes"/"y" plays a single bright bell ding, "no"/"n" a low double buzz.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@LitBomb

LitBomb commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

Please no. this would be super annoying. the ability to remotely trigger someone's devices to make sound is going to be abused for sure.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants