When people hear that Nexus Pen has a built-in speaker, they expect tinny, muffled audio — like a cheap toy. Then they hear Donna speak and their eyes go wide. Here's how we engineered HD audio into a device the size of a pen.
The Challenge
Fitting quality audio into a pen-shaped form factor is an engineering nightmare. You're working with minimal space, limited power, and a speaker driver that's barely an inch across. Most similar devices settle for 8kHz audio — telephone quality from the 1970s. We refused to compromise.
Our Solution: 24kHz Native u-law
Nexus Pen's audio pipeline runs at 24kHz — three times the sample rate of typical IoT audio. This gives us frequency response up to 11kHz, covering the full range of human speech with room to spare. Donna's voice sounds natural, clear, and present.
The encoding format is u-law (G.711), a proven codec that compresses 16-bit audio into 8 bits while preserving perceptual quality. It's the same encoding used in professional telephony, but we're running it at a much higher sample rate.
The BLE Delivery System
Audio data travels from your phone to the pen via Bluetooth Low Energy. BLE wasn't designed for streaming audio — it's meant for small, infrequent data packets. So we engineered a burst delivery system:
- MTU 512 — We negotiate the largest possible packet size (500 bytes per packet vs. the typical 240)
- Burst mode — Instead of steady streaming, the app sends audio in rapid bursts that fill the pen's ring buffer
- 250ms prebuffer — We accumulate a quarter-second of audio before playback starts, absorbing any BLE timing jitter
- 3x DMA buffer — 340ms of I2S DMA buffer capacity ensures the speaker never starves, even when the OLED display's I2C bus temporarily blocks the main loop
The Hardware
The speaker is a Dayton Audio CE32A-8 — a 1.25-inch full-range driver rated at 8 ohms. It's driven by a MAX98357A Class D amplifier, which is remarkably efficient and produces clean output even at high volumes. The combination delivers surprising bass response and clear mids from a package smaller than a coin.
Volume Control
Volume is adjustable in real time through both the pen's settings menu and voice commands. Say "Donna, raise volume" or "Donna, mute" and the firmware adjusts instantly. Volume settings persist across power cycles using the ESP32's Non-Volatile Storage (NVS).
The Result
When Donna speaks through Nexus Pen, you hear a clear, warm, natural voice — not a robotic squawk from a tiny speaker. It's the kind of audio quality that makes people do a double-take when they realize it's coming from a pen.
Engineering is about constraints. The tighter the constraints, the more creative the solution has to be. We think Nexus Pen's audio pipeline is one of the most creative things we've built.