
A $10 ESP32-S3 can turn spoken commands into text without an internet connection, using a trimmed version of Cactus Compute’s Whistle model. In a project by Better Stack, the board listens through an inexpensive microphone and changes the color of its onboard LED. The Whistle speech-to-text model runs entirely on the microcontroller, with neither Wi-Fi nor Bluetooth connected. Discover what it takes to fit the model on the board and how reliably it understands commands.
A Microphone Gives the Board an Offline Voice Input
TL;DR Key Takeaways :
- A trimmed Whistle model transcribes speech locally on a $10 ESP32-S3.
- The four-layer decoder fits on the board with 98 KB of flash free.
- Optimizations brought average response time to about 10 seconds.
- Short phrases were recognized more reliably than individual color words.
- Keyword biasing and a retry rule improved color-command results.
The ESP32-S3 development board runs at 240 MHz and has 16 MB of flash storage and 8 MB of memory. The build adds an INMP441 digital microphone costing a couple of dollars and a push button soldered onto perfboard. Eight wires connect the added components, while the RGB LED is already on the board. A power bank supplies power, and keeping recognition offline means speech is not sent over an internet connection.
Hold the button while speaking and the LED turns white to show that recording is underway. Releasing it starts processing, during which the light pulses dimly before carrying out the requested action. The board flashed purple for five seconds in response to one command and also responded to a command in another language. A laptop can display the transcript, LED action and processing times through the project’s terminal app, but the board does the processing itself.
A Smaller Decoder Fits Whistle Into Flash
Fitting the model is the first obstacle. Cactus Compute released Whistle on October 2 as a single 16.9 MB file, larger than the board’s flash even before firmware is included. Its audio encoder and text decoder each have eight layers, but the decoder was trained to remain functional with fewer layers. All eight encoder layers still need to run.
A custom tool creates a file containing only the selected layers. The stripped file produced exactly the same output as the full model running at the same depth, and Cactus’s engine loaded it without complaints. The project uses a four-layer decoder and extends the model partition to the end of the flash chip, leaving 98 KB free. It made noticeably fewer mistakes than the two-layer version.
The full model’s largest component is its engram lookup-table memory, at about 5.3 MB, almost a third of the file. Each decoder layer occupies about half a megabyte, so removing layers recovers space without discarding the encoder. Cactus provides engine builds for 17 platforms, including phones, laptops and browsers, but not this ESP32 chip, so the project required an implementation for the board.
Whistle Transcribes Seven Languages
Whistle automatically detects and transcribes seven languages: English, German, French, Spanish, Italian, Dutch and Polish. It can also produce word-level timestamps or turn an audio clip into an embedding without transcribing it. The model is open-source under the Apache 2.0 license and is available on HuggingFace.
The full file is almost nine times smaller than OpenAI’s Whisper Base, which is 145 MB. Cactus Compute says Whistle beats Whisper Base on LibriSpeech, a test set of people reading audiobooks aloud. The company also says Whistle produces its first word in about 11 milliseconds on a MacBook M4 Pro, a different device from the microcontroller used here.
Whistle uses the same engine as Cactus Compute’s Needle model, and the two are designed to load side by side. That setup can take an audio clip and return a tool call, providing a basis for a voice assistant on a small device. On this board, though, the models would need about 24 MB together. Whistle therefore runs alone, with a custom parser extracting the color and blinking instruction from its transcript.
Processing Audio Takes About 10 Seconds
Transcription starts with the microphone recording 16,000 samples per second. The audio is divided into 10 millisecond slices and converted into a MEL spectrogram, which measures energy at different pitches over time. Convolutional layers then compress it into 80 millisecond frames, so a two-second command becomes 25 frames.
In the encoder, each frame can attend to every other frame in the clip, allowing a sound at the beginning to be interpreted in the context of the end. The decoder first outputs a language token, then writes text piece by piece while checking the encoder’s output through cross-attention. Its engram lookup tables let it retrieve some information rather than calculate all of it.
The first implementation took almost 24 seconds to process a two-second command, with much of that time spent on matrix math involving millions of multiplications between audio and model weights. Optimizations process several frames in one pass, divide work across both processor cores and move heavy math to 8-bit integers on the ESP32-S3 vector unit. The unit can perform several multiplications simultaneously, and the four-layer model responds in about 10 seconds on average.
Individual timings vary with the prompt and language. In the connected-terminal demonstration, “Flash the light blue” took 8.8 seconds, while a French command that produced a purple light took 11.7 seconds. In an earlier Needle 2 project on the same kind of board, commands had to be typed and a single command took around 40 seconds.
Short Phrases Give the Model More Context
Tests found that short phrases were recognized correctly 82 to 93% of the time, compared with 44% for a single color word. A model trained on full sentences has little sound and almost no context to work with when it hears just one word. For this build, saying “make it red” is a better choice than saying “red” alone.
In English color-command tests using synthetic voices rather than real people, the board got about 78% of commands right. Adding real microphone noise barely changed that result, though synthetic-voice tests are only a rough guide to real-world accuracy. On the color-command test, the cut-down model on the chip beat Cactus’s full-size model in every language.
That improvement was attributed to two additions rather than the smaller model being inherently smarter. Keyword biasing supplies a list of color words and nudges the model toward them when it is uncertain. If a first transcription finds no color, a retry rule tries a different language and accepts the result only if it is almost as confident as the first attempt.
We think the short-phrase results make this a worthwhile project for experimenting with private voice controls, but the response time and single-word accuracy are important limits. A builder should plan around complete commands rather than expect a color word on its own to work reliably. The synthetic-voice results are useful for comparison, but they are not a substitute for checking the finished device with the people who will use it.
The project’s GitHub repository provides the build for anyone who wants to flash the same gadget. Beyond the LED demonstration, ESP32-S3 speech recognition has potential in voice-controlled home automation, privacy-focused portable devices and educational tools for speech recognition and embedded AI.
More on ESP32 and Arduino:
- Free Open-Source App Turns Any Audio File Into Text Offline
- Whryte 4x Faster than Typing : Offline Speech-to-Text App for Mac
Media Credit: Better Stack
Disclosure: Some of our articles include affiliate links. If you buy something through one of these links, Geeky Gadgets may earn an affiliate commission. Learn about our Disclosure Policy.